Import Error! "There is a Syntax Error"
nverma
Member Posts: 396
I am trying to import a PDF. This is the code I have for the import. But when I try to compile it, it give me message saying "There is a syntax error"
I cant seem to find error in this code anywhere. Anyone have any ideas or suggestions what might be causing this problem.
PDFExists := "File Data".HASVALUE;
IF "File Data".IMPORT ('*.PDF', TRUE) =' ' THEN BEGIN
MESSAGE (Text005);
EXIT;
END
IF PDFExists THEN
IF NOT CONFIRM (Text001, FALSE) THEN
EXIT;
CurrForm.SAVERECORD;
Any help will be greatly appreciated. Thanks in advance!
I cant seem to find error in this code anywhere. Anyone have any ideas or suggestions what might be causing this problem.
PDFExists := "File Data".HASVALUE;
IF "File Data".IMPORT ('*.PDF', TRUE) =' ' THEN BEGIN
MESSAGE (Text005);
EXIT;
END
IF PDFExists THEN
IF NOT CONFIRM (Text001, FALSE) THEN
EXIT;
CurrForm.SAVERECORD;
Any help will be greatly appreciated. Thanks in advance!
0
Comments
-
It is probably the missing semicolon after the END statement.Thomas Martin
NAV Developer0 -
I move some of the code around and now it works! It opens a window where I can select a file I want to import. But when I click the Ok button to import it, it doesnt do anything. Anyone have any idea, what might be wrong with the code?0
-
It looks correct. It's structured exactly the same as the picture import on Company Information.
"File Data" is a BLOB in your record?0 -
Yup. I got the code from company information. I just manipulated it a little to fit my needs.
It is a BLOB. I just have no idea why its not working.
Now when I click on the Import button it open the window where I can select the file I want to import. But when I select the file and click Ok. It doesnt do anything. Any idea whats going on.
How do i change all types from BMP image to PDF (Check out the Screenshot, you will know what i mean). Right now its set ot BMP image. Any Ideas or suggestions?
Screenshot link.
Problem.png - 0.13MB0 -
http://msdn.microsoft.com/en-us/library/dd355181.aspx
Based on your selection, only the appropriate file types are shown.
For example, if you select Bitmap, only files with the extension .bmp are shown.
If you select Memo, only files with the extension .txt are shown. I
f you select User-Defined, all files are shown.0 -
I was able to get the import to work.
How can i display the name of the file that was imported? I am able to get the name and the path of the file. But i only want to display the name.
I tried doing it, the following way, but doing it this way displays the import dialoug box twice. I tried setting the TRUE to FALSE.
"Filename := "File Data".IMPORT ('*.PDF;*.doc;*.docx;*.xls;*.xlxs', FALSE);"
But I get another the following ERROR message: "The file name *.PDF;*.doc;*.docx;*.xls;*.xlxs' contains a character that cannot be used. Check the file name."
Any ideas?
This is what I have so far.
CALCFIELDS ("File Data");
IF "File Data".HASVALUE THEN
FileExists := TRUE;
Filename := "File Data".IMPORT ('*.PDF;*.doc;*.docx;*.xls;*.xlxs', TRUE);
IF "File Data".IMPORT ('*.PDF;*.doc;*.docx;*.xls;*.xlxs', TRUE) ='' THEN
BEGIN
ERROR(Text005)
END;
IF FileExists THEN
IF NOT CONFIRM (Text001, FALSE) THEN
EXIT;
CurrForm.SAVERECORD;0 -
nevermind...i figured it out. Thanks0
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
- 322 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
