//*********** SALES LINE ************ SL2.RESET; SL2.SETRANGE(SL2."Document Type",DocType); SL2.SETRANGE(SL2."Document No.",DocNo); IF SL2.FIND('+') THEN BEGIN LineNo := SL2."Line No." + 10000; END ELSE BEGIN LineNo := 10000; END; SL.RESET; SL."Document Type" := DocType; SL."Document No." := DocNo; SL."Line No." := LineNo; SL.Type := SL.Type::Item; //Item No. PosCode:=STRPOS(vString,';'); SL.VALIDATE(SL."No.",FORMAT(COPYSTR(vString,1,PosCode-1))); vString:=DELSTR(vString,1,PosCode); SL.Imported := TRUE; SL.INSERT(TRUE);
Comments
Why not just map the fields at the first point when you get a line #?
What's your thinking on the use of SL2?
2 resets?
Simplify.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Also try to provide some more details. Is this a dataport? Where is the code located? Are there any more lines of code?
Hi Savatage,
i use SL2, just to get last line no
so the main SL is SL
i change the code become like this
but still the same result
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
i change my code
and it still the same result
only last line will tick imported as true
what happened with my code
:-k :-k
this is my full code
LineNo is an integer variable. The SL filter on your code messed up the record reference.
Just a happy frood who knows where his towel is
i use the same as you give me
but still the same
only last line for every document will updated
here is the result in my attachment
Just a happy frood who knows where his towel is
i import from txt file
sales header no problem
but sales line have a problem
Like in Sales header field validations?
why because you are validating all sales header fields for second time but not inserting if it is same doctype and docno..
Please check..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Just a happy frood who knows where his towel is
there is no other code
this is single and independent codeunit
i trigger it by hit run button from this codeunit directly
I mean in Sales Headder table onvalidate trigger's of all fields..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
only add new fields
Looking at your screenshot, the first 2 lines do not have 'test' as description.
check also your sales header table to see if there is any validation that refresh the sales line.
Just a happy frood who knows where his towel is
that's it...
these 5 records are inserted from my code
take a look from item no, this one inserted from txt file
i think this one is because validation
i think the is not related with sales header
because first i insert header...... after that sales line, how come it come back to sales header
all correct... but when i open the table
like this
weird
Hi Bernard,
i tried your code
but the result still the same
Change the line description before running to something else to make sure that code is working. Because if it's inserting the description it should mark imported as well. Also do you get the same results if you sl.insert as opposed to sl.insert(true)?
http://www.BiloBeauty.com
http://www.autismspeaks.org
when i catch the code using message, it's correct
every description would be 'Test'
but the result is not....
i tried sl.insert and sl.insert(true) already...
i think this one is because validation
i think it because when we move to another line
example from line 1 to line 2
because if we only have 1 item in 1 document, there is no problem
still haven't solve this issue
Just a happy frood who knows where his towel is
can we debug it?
Just a happy frood who knows where his towel is
i block my validation for item no in sales line
but still the same result
do you think on insert in sales line table?
Perhaps you can force it. how about changing the end part from
SL.Imported := TRUE;
SL.INSERT(TRUE);
to
SL.INSERT(TRUE);
SL.Imported := TRUE;
SL.MODIFY;
http://www.BiloBeauty.com
http://www.autismspeaks.org
i tried your code , but the result still the same
after insert, i also add this code
still the same
it's not working
i starting to hopeless with this