Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I'm trying to create a table that holds the names and position numbers of fields in a QVD.
For example if I have a QVD with the following fields:
FIELDA, FIELDB, FIELDC
The table would be:
FIELDNAME FIELDPOSITION
FIELDA 1
FIELDB 2
FIELDC 3
The script I've written for this is:
EMPTYTABLE:
LOAD *
FROM QVDNAME (qvd)
where 1 = 0;
TABLE_FIELDS:
load IterNo() as FIELD_NUMBER,
FieldName(IterNo(), 'EMPTYTABLE') as FIELD_NAME
autogenerate 1
while IterNo() < NoOfFields('EMPTYTABLE');
This produces a table with the correct number of rows. FIELD_NUMBER is populated correctly but FIELD_NAME is null.
Have I missed something obvious? I'd be greatful for any help/explanations!
I wouldn't do it that way. Access the XML structure as this ...
TABLE_FIELDS:
LOAD
Rowno() as FIELD_NUMBER,
FieldName as FIELD_NAME
FROM [{name}.qvd] (XmlSimple, Table is [QvdTableHeader/Fields/QvdFieldHeader]);
.. really simple and quick.
flipside
EDIT: If querying multiple qvds, then the Rowno() will continue incrementing from last stored value, so RecNo() might be neaded to give you the Field_Number within the QVD.
I wouldn't do it that way. Access the XML structure as this ...
TABLE_FIELDS:
LOAD
Rowno() as FIELD_NUMBER,
FieldName as FIELD_NAME
FROM [{name}.qvd] (XmlSimple, Table is [QvdTableHeader/Fields/QvdFieldHeader]);
.. really simple and quick.
flipside
EDIT: If querying multiple qvds, then the Rowno() will continue incrementing from last stored value, so RecNo() might be neaded to give you the Field_Number within the QVD.