Skip to main content

Notifications

Announcements

No record found.

Line Split in Subform

Hi all,

I wanted to split the line into two in subform as it should follow the sequence.

If line 10000 and 20000 is present, and if you split line 10000, then the split line must be 15000. If you split line 10000 again, then the split line must be 12500 and so on.

I found the standard code in Table 5767, Warehouse Activity Line, function SplitLine().

So, I used the same pattern for my purpose.

Code as follows:


NewWhseActivLine := WhseActivLine;
NewWhseActivLine.SETRANGE("No.",WhseActivLine."No.");
IF NewWhseActivLine.FIND('>') THEN
LineSpacing :=
   NewWhseActivLine."Line No." - WhseActivLine."Line No.") DIV 2
ELSE
LineSpacing := 10000;

NewWhseActivLine.RESET;
NewWhseActivLine.INIT;
NewWhseActivLine := WhseActivLine;
NewWhseActivLine."Line No." :=
   NewWhseActivLine."Line No." + LineSpacing;

Explanation: It sets a new record from the existing Warehouse Activity Line. Then filters to the same Document No. to check there are other lines exist which are greater than the current line.

If not, assign LineSpacing with 10000 and add when the split line is inserted.

If there is a line exist, then get the difference from the both lines and get the DIV of the difference and assign it to LineSpacing.

 



This was originally posted here.

Comments

*This post is locked for comments