Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys
Is it possible to get the field names from the source Table but not the data. forexample by using FileBaseName() , i get name of the File only.
ForExample:
ID | Name |
1 | Rahul |
2 | John |
When i load the above table in Qlikview ,i should get one column containing the Name of the Field (i.e. ID and Name) but no data.
i only need field names. Is it possible????????
Hi
Try like this
Load * from tablename where 1=1;
Hope that helps
Gives only field name
Hi,
You can use FieldName() function.
Ex.
FieldName(1,'Table1') will retrieve the first fieldname from Table1.
Regards,
Janzen
I guess you meant "WHERE 1=2".
Since 1=1 will fetch all the records while 1=2 will fetch none.
Hi,
Use the function NoOfFields(tablename) to get number of fields from your table.
Then use a loop For next on each field and get the name with the function fieldName(FieldNo,tablename).
Create dynamicly into the loop a table containing fields names.
Regads
Hi Hulk,
Ya want to use where 1= 2 condition..
Load * from tablename where 1=2;
Wrongly typed..Thnx
Hi guys thanks For replies..... but i want that when i load the table into Qlikview then i should get a column that will give me name of all Fields in that table .......
For example
Load
________ as FieldNames
From TableName;
I do not want any fields with data
Do like this:
FOR fieldNo = 1 to NoOfFields('tablename')
let _fieldName = fieldName($(fieldNo), 'tablename');
TABLE_FIELDS:
LOAD
'$(_fieldName)' as FIELD_NAME
autogenerate 1;
next
Before this script, you need to load the table, and then drop it if you don't want data.
Regards
Check the attached file
Can i do it without loading the table into qlikview first??? i mean to say that directly from the source table load the field names into one column?????