Announcements
Hi everyone,
I had one code problem here. I want try to change the the line section as follow:
i) Line no. with ID 1000 -Description 'Bicycle' change to test777,
ii) Line no.with ID 1120-Description 'spokes' change to test888.
iii)Line no .with ID 1001-quantity '1' change to 10
Here are the code that I had try to scratch out, but the output not been successful as I mentioned above.
Here is the code for change description part:
g_recSalesLine.SETRANGE("Line No.","Line No."); g_recSalesLine.SETRANGE("Document Type","Document Type"); g_recSalesLine.SETRANGE("Document No.","Document No."); IF g_recSalesLine.FINDFIRST THEN BEGIN g_recSalesLine.SETRANGE("Description",'Bicycle','Bicycle'); g_recSalesLine.Description := g_txtDesc; g_recSalesLine.MODIFYALL(Description,'TEST11'); END;
One question for this description part, for example: is it I have to used the Line no. ='1000', then the description will direct change to test777? And Line No. ='1120', then change to test 888?
Between can somebody tell me how to modify my code above?
Another part is the quantity, below are the code of quantity that I had scratch out:
g_recSalesLine.SETRANGE(Quantity,Quantity); IF g_recSalesLine.FINDFIRST THEN BEGIN g_recSalesLine.Quantity := g_decQty; g_recSalesLine.MODIFY; END;
If I used the code of quantity, it will direct change all 3 lines of quantity to '10',but not only Line No. ='1001'(I only want to change the quantity to 10 with Line No. ='1001'.
Hope anyone can help me out for the problem above.
Many thanks here.
*This post is locked for comments
Are you filtering Line No or No ? Those are two different fields.
I will give you one example based on what you are trying to do.
g_recSalesLine.SETRANGE("Document Type","Document Type");
g_recSalesLine.SETRANGE("Document No.","Document No.");
g_recSalesLine.SETRANGE(Type,g_recSalesLine.Type::Item);
g_recSalesLine.SETRANGE("No.",'1000');
IF g_recSalesLine.FINDFIRST THEN BEGIN
g_recSalesLine."Description" := 'TEST777';
g_recSalesLine.MODIFY(TRUE);
END;
You are not supposed to filter the filter where you want to modify. If you want to do this, use two variables.
g_recSalesLine.SETRANGE(Quantity,Quantity);
IF g_recSalesLine.FINDFIRST THEN BEGIN
g_recSalesLine2 := g_recSalesLine;
g_recSalesLine2.VALIDATE(Quantity,g_decQty);
g_recSalesLine2.MODIFY(TRUE);
END;
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156