Dataport Set particular line to a variable

sabzam
Member Posts: 1,149
Hi,
I have the following csv file
The dataport has already been created to enter the date, details and amount into their corresponding columns in the table and it works fine. The problem is with the account number i.e the first line (40014065156). i want to store it in a variable instead. How can I do so and in which trigger?
Regards,
I have the following csv file
-
40014065156
Date,Detail,Amount
04/11/2008,XXXXXXXXX,75.00
05/11/2008,XXXXXXXXX,65.00
06/11/2008,XXXXXXXXX,85.00
07/11/2008,XXXXXXXXX,95.00
08/11/2008,XXXXXXXXX,100.00
09/11/2008,XXXXXXXXX,200.00
10/11/2008,XXXXXXXXX,300.00
The dataport has already been created to enter the date, details and amount into their corresponding columns in the table and it works fine. The problem is with the account number i.e the first line (40014065156). i want to store it in a variable instead. How can I do so and in which trigger?
Regards,
0
Answers
-
Global Variable: AccountNo
OnAfterImportRecord:
IF AccountNo = '' THEN BEGIN //Is not filled in
AccountNo := ColumnFromFile;
CurrDataport.SKIP; //So you don't continue processing that line
END;
That should get you started. Other changes may be necessary. Ideally they would be in the file as separate data items with a blank line in between (or whatever the DataItemSeparator property is set to).0 -
Hi,
Thanks for your reply but what is ColumnFromFile? Is it a variable or is it build-in in navision because it is giving me the error that i have specified an unknown variable
Regards,0 -
The problem is that the file is not "Dataport frendly". You need to read the whole line into variable and than parse it yourself, or use CurrFile.READ in OnPreDataItem to read the first and second line and let the rest go through standard reading...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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