XMLport 2013 import line already exist
ilovenav
Member Posts: 9
please help, im newbie to this
when i import it to nav the error show that line no 10000 already exist.
i check the Item journal line, no data at all.
if i debug, it pointing to "IF IJL1.FINDLAST THEN BEGIN"
this is my code :
sorry for my poor english
thanks before
when i import it to nav the error show that line no 10000 already exist.
i check the Item journal line, no data at all.
if i debug, it pointing to "IF IJL1.FINDLAST THEN BEGIN"
this is my code :
IJL_ - Import::OnBeforeInsertRecord()
IJL1.RESET;
IJL1.SETRANGE("Journal Template Name",'PHYS. INVE' );
IJL1.SETRANGE("Journal Batch Name",BatchName);
IJL1.SETRANGE("Source Code",'PHYSINVJNL');
IF IJL1.FINDLAST THEN BEGIN
LineNo := IJL1."Line No.";
END;
LineNo += 10000;
IJL_.RESET;
WITH IJL_ DO BEGIN
IJL_."Journal Template Name" := 'PHYS. INVE';
IJL_."Journal Batch Name" := BatchName;
IJL_."Line No." := LineNo;
VALIDATE(IJL_."Item No.",ItemNo);
IJL_."Source Code" := 'PHYSINVJNL';
CLEAR(VarDate);
EVALUATE(VarDate,PostDate);
VALIDATE(IJL_."Posting Date",VarDate);
VALIDATE(IJL_."Entry Type",IJL_."Entry Type"::"Positive Adjmt.");
VALIDATE(IJL_.Description,Desc);
VALIDATE(IJL_."Location Code",Loc);
CLEAR(VarDec);
EVALUATE(VarDec,Qty);
VALIDATE(IJL_.Quantity,VarDec);
VALIDATE(IJL_."Unit of Measure Code",UOM);
IJL_.INSERT;
END;
sorry for my poor english
thanks before
0
Comments
-
Hi, I think you need to change this code
IF IJL1.FINDLAST THEN BEGIN LineNo := IJL1."Line No."; END; LineNo += 10000;
InIF IJL1.FINDLAST THEN LineNo := IJL1."Line No." ELSE LineNo += 10000;
And then it should work.* Daniele Rebussi * | * Rebu NAV Diary *0 -
geordie wrote:Hi, I think you need to change this code
IF IJL1.FINDLAST THEN BEGIN LineNo := IJL1."Line No."; END; LineNo += 10000;
InIF IJL1.FINDLAST THEN LineNo := IJL1."Line No." ELSE LineNo += 10000;
And then it should work.
still got the same error.
debug also pointing to
"IF IJL1.FINDLAST THEN"
any other solution?0 -
please help...
[-o<0 -
Hey,
if you ONLY have records with "Source Code" = 'PHYSINVJNL' then, don't filter it. Otherwise you will get the error that the line already exists, when you already have data without the filtered source code in your Journal Line, because it's not part of your primary key.IJL1.SETRANGE("Source Code",'PHYSINVJNL'); .. IJL_."Source Code" := 'PHYSINVJNL';
I would write your FINDLAST like this (but yours should work as well)IF IJL1.FINDLAST THEN LineNo := IJL1."Line No." + 10000 ELSE LineNo := 10000;
Check if you really assign the correct values, which you filter on, to your new record.0 -
-Christoph wrote:Hey,
if you ONLY have records with "Source Code" = 'PHYSINVJNL' then, don't filter it. Otherwise you will get the error that the line already exists, when you already have data without the filtered source code in your Journal Line, because it's not part of your primary key.IJL1.SETRANGE("Source Code",'PHYSINVJNL'); .. IJL_."Source Code" := 'PHYSINVJNL';
I would write your FINDLAST like this (but yours should work as well)IF IJL1.FINDLAST THEN LineNo := IJL1."Line No." + 10000 ELSE LineNo := 10000;
Check if you really assign the correct values, which you filter on, to your new record.
the table is absolutely empty. whatever field that i use for setrange, it doesn't really mattered.
and i use your code but still the same error.
i used the same code with a little modification so that i can run in dataport nav 2009(classic)
and its success with no error.
thanks i appreciate your help, but i think i have to close this thread in one week if no one reply this again
because i give up on this one.0 -
Maybe you don't need to set filters before the FINDLAST
(Because Line No. is the primary Key of the table)0 -
If everything happens on the Import::OnBeforeInsertRecord() of the IJL_ table trigger, it seems that the "INSERT" instruction, have no sense there...
Try to delete it0 -
VectorK wrote:If everything happens on the Import::OnBeforeInsertRecord() of the IJL_ table trigger, it seems that the "INSERT" instruction, have no sense there...
Try to delete it
thank you again but if i delete the "INSERT", microsoft dynamic nav is not responding and then crash0 -
So, at this point, why don't you set on Table element the property Temporary to Yes and fetch the records read from file in OnPostXMLport trigger?
In this way you will be able to manage all the logic by C/AL code.* Daniele Rebussi * | * Rebu NAV Diary *0 -
geordie wrote:So, at this point, why don't you set on Table element the property Temporary to Yes and fetch the records read from file in OnPostXMLport trigger?
In this way you will be able to manage all the logic by C/AL code.
thank you but still...
i put all the C/AL code in OnPostXMLport trigger, but its like no code at all.
even if i just use "message('Test');"
nothing show up.
is this mean my Nav 2013 application have a problem?0 -
i closed this topic with no solution.
thank you0
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
