How to pull out data if the value in one of the field matche
sunnyk
Member Posts: 280
Hi experts,
I have one txt file with Item No. Now suppose if the first 3 charcters of the item no. in the text file matches the item no in Navision it pulls that item no from navision to me(in txt file).
How to do this.
I have one txt file with Item No. Now suppose if the first 3 charcters of the item no. in the text file matches the item no in Navision it pulls that item no from navision to me(in txt file).
How to do this.
0
Comments
-
Hi Sunnyk,
1) Use two dataports : one for import and other for export.
2) call the export Dataport from OnPostDataItem() of first Dataport.
3) In Import Dataport, import the text file Items in the Navision table with a tag on them so that you can Identify them later and delete.
4)Mark the Item Nos of Interest (i.e. first 3 characters are same as that of in text file). this can be done while importing.
5) Once the item Nos are marked, delete the item nos just imported into the table.
6) call the export dataport which will export only marked records.
Here are the objects for two Dataports.. O:)OBJECT Dataport 90000 DP1- Start { OBJECT-PROPERTIES { Date=07/11/08; Time=[ 6:42:18 PM]; Modified=Yes; Version List=; } PROPERTIES { Import=Yes; FieldStartDelimiter=None; FieldEndDelimiter=None; } DATAITEMS { { PROPERTIES { DataItemTable=Table27; DataItemTableView=SORTING(No.); OnPreDataItem=BEGIN it1.RESET; END; OnAfterImportRecord=BEGIN "No." := 'ZZZ' + Item."No." ; // the trick part IF it1.FINDSET THEN REPEAT IF (COPYSTR(it1."No.",1,3) = COPYSTR("No.",4,3)) THEN it1.MARK(TRUE); UNTIL it1.NEXT = 0; END; OnPostDataItem=BEGIN it2.RESET; IF it2.FINDSET THEN REPEAT IF (COPYSTR(it2."No.",1,3) = 'ZZZ') THEN BEGIN it3 := it2; it3.DELETE; END; UNTIL it2.NEXT = 0; DATAPORT.RUN(90001,FALSE,it1); END; } FIELDS { { ; ;"No." } } } } REQUESTFORM { PROPERTIES { Width=19690; Height=3410; } CONTROLS { } } CODE { VAR it1@1102753000 : Record 27; it2@1102753001 : Record 27; NoStr@1102753002 : Text[1024]; IT@1102753003 : Record 27; PathExport@1102753004 : Text[200]; CD@1102753005 : Codeunit 412; ExportDp@1102753006 : Dataport 90001; PathImport@1102753007 : Text[200]; it3@1102753008 : Record 27; BEGIN END. } }OBJECT Dataport 90001 DP2-export { OBJECT-PROPERTIES { Date=07/11/08; Time=[ 6:38:01 PM]; Modified=Yes; Version List=; } PROPERTIES { Import=No; FieldStartDelimiter=None; FieldEndDelimiter=None; OnInitDataport=BEGIN CurrDataport.FILENAME := CD.OpenFile('Enter path name','*.txt',1,'*.txt',0); END; } DATAITEMS { { PROPERTIES { DataItemTable=Table27; DataItemTableView=SORTING(No.); OnPreDataItem=BEGIN MARKEDONLY(TRUE); END; } FIELDS { { ; ;"No." } } } } REQUESTFORM { PROPERTIES { Width=9020; Height=3410; } CONTROLS { } } CODE { VAR it1@1102753000 : Record 27; it2@1102753001 : TEMPORARY Record 27; NoStr@1102753002 : Text[1024]; IT@1102753003 : Record 27; CD@1102753004 : Codeunit 412; BEGIN END. } }Sandeep Prajapati
Technical Consultant, MS Dynamics NAV0
Categories
- All Categories
- 75 General
- 75 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions