Importing a text file!!
sunnyk
Member Posts: 280
Hi experts,
I m using Nav 3.7. Whenever i import a textfile into Journal(say to post the payrol data), a message appeared every time
"The Operating System cannot find the drive and directory specified for the file "Notepad.exe C:\path of the file
Please Check that the drive ,directory and files are correct".
Although the data got inserted.but why i got this message everytime whenever i m importing through text file.
Any suggestions!!!
I m using Nav 3.7. Whenever i import a textfile into Journal(say to post the payrol data), a message appeared every time
"The Operating System cannot find the drive and directory specified for the file "Notepad.exe C:\path of the file
Please Check that the drive ,directory and files are correct".
Although the data got inserted.but why i got this message everytime whenever i m importing through text file.
Any suggestions!!!
0
Comments
-
Hi,
I suggest you open the object that you are running and see if there is a SHELL command that is running notepad.
Albert0 -
This seem problem related to the attributes of the file/drive. you need to check whether you are authorized to read/modify the drive/file .Thanks,
Ritesh K Singh0 -
Hi Albert,
Yes there is command which create the File at the Onpredataitem ofthe dataport(used for importing the data from Text file.)0 -
Hi Sunnyk,
Could you post the code here as I'm only guessing what is running.
Albert0 -
Albert,
First of all thanks for your Interest.
Here is the code :Integer - OnPreDataItem() IF DocumentNo=''THEN BEGIN ERROR('Document No. can not be blank'); END; ShowXfile := FALSE; Xfile.WRITEMODE := TRUE; Xfile.TEXTMODE := TRUE; Xfile.CREATE('C:\Payroll.txt'); "rec Gen. Journal Line".RESET; "rec Gen. Journal Line".SETFILTER("Journal Template Name",'%1',JTN); "rec Gen. Journal Line".SETFILTER("Journal Batch Name",'%1',JBN); IF "rec Gen. Journal Line".FIND('+')THEN BEGIN lineno:="rec Gen. Journal Line"."Line No."+10000; END ELSE BEGIN lineno:=10000; END; IF LegacyGLAccountDept <>'' THEN BEGIN LegacyGLAccount:=COPYSTR(LegacyGLAccountDept,1,3); GLDept:=COPYSTR(LegacyGLAccountDept,5,STRLEN(LegacyGLAccountDept)-4); "Legacy G/L Account".RESET; "Legacy G/L Account".SETFILTER("No.",'%1',LegacyGLAccount); IF "Legacy G/L Account".FIND('-') THEN BEGIN deptcode:=''; BUCode:=''; "Dimension Value".RESET; "Dimension Value".SETFILTER("Dimension Value"."Dimension Code",'%1','Dept'); "Dimension Value".SETFILTER("Dimension Value"."ADP Code",'%1',GLDept); IF "Dimension Value".FIND('-') THEN BEGIN deptcode:="Dimension Value".Code; BUCode:="Dimension Value"."ADP BU Code"; END; IF NOT ((deptcode='') AND (GLDept<>'00000')) THEN BEGIN "rec Gen. Journal Line".INIT; "rec Gen. Journal Line".VALIDATE("Journal Template Name",JTN); "rec Gen. Journal Line".VALIDATE("Journal Batch Name",JBN); "rec Gen. Journal Line".VALIDATE("Line No.",lineno); "rec Gen. Journal Line".VALIDATE("Document No.",DocumentNo); "rec Gen. Journal Line".VALIDATE("Posting Date",PostingDate); IF LegacyGLAccount='107'THEN BEGIN "rec Gen. Journal Line".VALIDATE("Account Type",3); "rec Gen. Journal Line".VALIDATE("Account No.",'payroll'); END ELSE BEGIN "rec Gen. Journal Line".VALIDATE("Account Type",0); "rec Gen. Journal Line".VALIDATE("Account No.","Legacy G/L Account"."G/L Account No."); END; "rec Gen. Journal Line".VALIDATE("Posting Date",PostingDate); //"rec Gen. Journal Line".Description "rec Gen. Journal Line".VALIDATE(Amount,amt); "rec Gen. Journal Line".VALIDATE("Shortcut Dimension 1 Code",deptcode); "rec Gen. Journal Line".VALIDATE("Shortcut Dimension 2 Code",BUCode); "rec Gen. Journal Line".INSERT(TRUE); COMMIT; lineno+=10000; END ELSE BEGIN ShowXfile := TRUE; Xfile.WRITE('Dept not found '+GLDept+' not Found'); END; END ELSE BEGIN ShowXfile := TRUE; Xfile.WRITE('G/L Account'+LegacyGLAccount+' not Found'); END; END; IF LegacyGLAccountDept <>'' THEN BEGIN LegacyGLAccount:=COPYSTR(LegacyGLAccountDept,1,8); GLDept:=COPYSTR(LegacyGLAccountDept,11,5); deptcode :=GLDept; "rec Gen. Journal Line".INIT; "rec Gen. Journal Line".VALIDATE("Journal Template Name",JTN); "rec Gen. Journal Line".VALIDATE("Journal Batch Name",JBN); "rec Gen. Journal Line".VALIDATE("Line No.",lineno); "rec Gen. Journal Line".VALIDATE("Document No.",DocumentNo); "rec Gen. Journal Line".VALIDATE("Posting Date",PostingDate); "rec Gen. Journal Line".VALIDATE("Account Type",0); "rec Gen. Journal Line".VALIDATE("Account No.",LegacyGLAccount); "rec Gen. Journal Line".VALIDATE("Posting Date",PostingDate); "rec Gen. Journal Line".VALIDATE(Amount,amt); "rec Gen. Journal Line".VALIDATE("Shortcut Dimension 1 Code",deptcode); "rec Gen. Journal Line".INSERT(TRUE); COMMIT; lineno+=10000; END ELSE BEGIN ShowXfile := TRUE; Xfile.WRITE('G/L Account'+LegacyGLAccount+' not Found'); END; Integer - OnPostDataItem() IF ShowXfile THEN SHELL('Notepad.exe C:\Payroll.txt');0 -
Hi,
I think that you should change thisIF ShowXfile THEN SHELL('Notepad.exe C:\Payroll.txt');
toIF ShowXfile AND EXIST('C:\Payroll.txt') THEN SHELL('Notepad.exe', 'C:\Payroll.txt');
Hope this helps
Albert
Edit: Tried to put ', ' in bold0 -
You need to CLOSE the file first, otherwise it won't exist yet !0
-
oh Thanks a lot Everyone.The Issue is resolved now.
Thank you very much Albert and MBerger!0
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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 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