How to Create s CSV file in C/AL programming
Sreenivasan
Member Posts: 3
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 .
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
-
Your question is very complex, but some things can be written shortly:
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)0 -
Dude! A lot of what you are requesting is covered in the Application Designer's Guide, which resides on your Navision installation CD in the Documents folder. I would suggest you crack that open for a while. It is the primer for up-and-coming developers.Kristopher Webb
Microsoft Dynamics NAV Developer0 -
Hi Lubost,
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;0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions