Hi Expert,
I want to save in sales line when user multi line select from item.
My sample code.
p_txtFilterNo := frm_ItemList.GetSelectionFilter; <--- Item List Function (Default)
l_recSalesLine.RESET;
l_recSalesLine.COPY(Rec);
WITH l_recSalesLine DO
BEGIN
l_recItem.RESET;
l_recItem.SETFILTER("No.",p_txtFilterNo);
IF l_recItem.FINDSET THEN BEGIN
REPEAT
BEGIN
INIT;
"Document Type" := SalesHeader."Document Type";
"Document No." := "Document No.";
"Line No." := "Line No." + 1; <--- This portion i want to get system set value.
Type := Type::Item;
VALIDATE("No.",l_recItem."No.");
INSERT;
END;
UNTIL (l_recItem.NEXT = 0);
END;
END;
CurrForm.UPDATECONTROLS;
I want to get auto line no. and save. Because sale line subform use autosplit key, so i want to use that function. We can not use "Line No." := "Line No." + 1. If user press F3, we can't increase mannual.
Line No Item
10000 10001
20000 10002
If user press F3 between Line 10000 and 20000 and then select item,
Line No Item
10000 10001
15000 10003 ---> System Generate (I want to get that id)
20000 10002
Another way which form/table can i refer. Please let me know.
Best Regards,
Yukon
Comments
If you need to insert between two existing lines then you need to write some code to first determine how many records you can insert, and then add code to keep track of how many you are inserting. In that case it would be nice if you could simulate the mechanism to look the same as standard NAV, but it really doesn't matter whether you add 1 or 2 or any number, the line number field is an integer, so any integer value will work.
RIS Plus, LLC
MVP - Business Apps
I agreed your suggestion. We can increase by manual. But we can get problem.
1. How can i know start value between existing line?
2. I know how many record insert into sales line. But ... If i increase manual, that increase value must be same existing value.
3. Autosplit key can insert between 10000 -- 20000, If you insert more line between that value, we will get error. So How to solve that error?
Line No Item No.
10000 balar balar
xxxxx balar balar ...... // 19999
20000 balar balar
Manual Insert ....
Line No Item No
10000 balar balar // Existing Data
19998 balar balar // Existing Data
20000 balar balar // Existing Data
20001 balar balar // Existing Data
When user press F3 and select three item. We can insert only 19999,?????,??????
Can you sugg: to me. Sorry for my many question.
Best Regards,
Yukon
RIS Plus, LLC
MVP - Business Apps
1 - You can retrieve the lines that belong to an order from the database. Say you have line 10000 and line 20000, then you have (20000 - 10000 - 1) lines that you can insert in between those two. How to insert them between two specific lines? Figure something out, use your brain
2 - You can insert line number 10001, and then 10025, and then 17453, it doesn't have to be the same interval between values. The Line Number field is an integer field and you can use any integer value for its value.
3 - Autosplitkey inserts the value in the middle between two existing lines. So between 10000 and 20000, it will insert 15000. Between 15000 and 20000, it will insert 17500, etcetera. Each time it splits the difference of the two integer values in half and adds that to the lowest value. At some point it is done, and you can't insert more in between, that's just the way it works.
So when you have line number 19998 and 20000, and you have inserted 19999, then you won't be able to insert more lines in between, and you will need to add the line with another line number.
RIS Plus, LLC
MVP - Business Apps
Thx for your reply.
Best Regards,
Yukon