Hi,
I am try to write a script which should dynamically fetch the TableName and the fileds and value of the Tables.And these data has to written in csv File.
And i am very very new to Navision i have lot and lot of questions in creating the script.
1.How can i find the TableName dynamically.
2.How can i get the Fields in the Table.
3.How can i get the Field Values in the Table.
4.How can i write in a csv file .
0
Comments
1. There exist variable type named RecordRef which can point to record in any table (see help or manual)
2. There exist variable type named FieldRef which can point to eny field in any table (see help or manual)
3. You must "only" create the loop thru all records and all fields in desired table and write values (use FORMAT function) to file (f.OPEN, f.Write, f.CLOSE)
Microsoft Dynamics NAV Developer
Thankyou very much for your valuable inputs,as said by you i have tried by using the Recordref and the fieldref but still am facing the issue.
I am giving code C\AL code written by be me i request you to suggest me for further move.
Script:
======
SourceName := xRec.TABLENAME;
FiledSet.OPEN(15); //Filedset is Recordref
currTblFieldCount := FiledSet.FIELDCOUNT; //currTblFieldCount is an Integer
idx := 1;
viewno := 1;
WHILE idx <> currTblFieldCount DO BEGIN
IF FiledSet.FIELDEXIST(viewno) THEN BEGIN
currField := FiledSet.FIELD(viewno);
MESSAGE('%1',viewno);
MESSAGE('%1',currField.NAME()); //currFiled is the Fieldref
MESSAGE('%1',currField.VALUE());
idx := idx +1;
END;
viewno := viewno +1;
END;