Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I need to make an maintenance of fields name. I intend to load all the fields from script into a csv file and i don't know how.
Thank you,
Cosmina
This script will export a table of TableNames & FieldNames.
FOR tableIdx = NoOfTables()-1 to 0 step -1
LET vTable = TableName($(tableIdx));
FOR fieldIdx = 1 to NoOfFields('$(vTable)')
FieldList:
LOAD
'[$(vTable)]' as TableName,
FieldName($(fieldIdx),'$(vTable)') as FieldName
AutoGenerate 1;
NEXT fieldIdx
NEXT tableIdx
STORE FieldList INTO FieldList.csv (txt);
Example attached.
-Rob
You can do some way with create the CSV file for your Data model and then work on the field which you want to keep or else you want to delete.
Ex:-
Let vFolder = 'C:\Users\CSV\';
for vCount = 0 to NoOfTables()-1
Let vTableName = TableName($(vCount));
STORE $(vTableName) into $(vFolder)$(vTableName).csv (txt);
next vCount
Regards
Anand
Hi, Thank you for the answer.
I need to export only the header in a single column, not the values and not on separate tables with their values. Meaning, all the fields name from all tables in a single column. And eventually a header on the second column, called New_Field. To understand exactly the process, i am going to send the file to my client, he is going to insert in the second column the new namind and I am going to use Rename Fields using FieldMap;
So, i need a way to prepare the file like as mapping table.
BR
This script will export a table of TableNames & FieldNames.
FOR tableIdx = NoOfTables()-1 to 0 step -1
LET vTable = TableName($(tableIdx));
FOR fieldIdx = 1 to NoOfFields('$(vTable)')
FieldList:
LOAD
'[$(vTable)]' as TableName,
FieldName($(fieldIdx),'$(vTable)') as FieldName
AutoGenerate 1;
NEXT fieldIdx
NEXT tableIdx
STORE FieldList INTO FieldList.csv (txt);
Example attached.
-Rob