Sir,
I've created a field named 'Quantity Available' in MR Subform page which will sum up all the quantityes available in the 'Quantity' field of the Item Ledger Entry table.I didn't declare the field as a flowfield. I wrote the following code in MR Subform page:
Quantity Available - OnValidate()
RecILE.SETCURRENTKEY(RecILE."Location Code");
RecILE.CALCSUMS(RecILE.Quantity);
But still doesn't get the required result. What should I do?
Thank You,
*This post is locked for comments
Directly use the decQty variable in the SourceExpr property.
Thank You Sir. But I have one more question.
I have declared a variable 'decQty' which stores all the records of 'Quantity' field after CALCSUMS.
I want the records stored in the decQty variable to be shown in the MR Line table which is the source table of this page. I wrote following code within the same trigger which is:
Rec."Quantity Available":=decQty;
But still it doesn't shows the records in the table. Can you plz help me!
Thank you Vishal for the response. I have one more question to ask you. I have written the code within OnAfterGetRecord() trigger & it works fine.
But I want the records stored in the decQty variable to be shown in the MR Line table which is the source table of this page. I wrote following code within the same trigger which is:
Rec."Quantity Available":=decQty;
But still it doesn't shows the records in the table. Can you plz help me!
Hey Rajat,
I will recommend you to first of all have a strong grip on the sequences of the triggers and which triggered is fired when.
As everyone in the thread recommended write your code on OnAfterGetRecord() - This trigger gets executed everytime you change the record on page.
Code what you are writing is OK and too what Vishal recommended but I will prefer Vishals one keeping Performance in mind.
Your code looks totally ok to me. I even tried the same code and it works like a charm. As nareshwar mention you might need to change the trigger where you have written your code. I would suggest you to go with OnAfterGetRecord( )
Hi Vishal,
In order to use the CALCSUMS, you don't need to find the Record. You may simply write the CALCSUMS just after your SETRANGE.
Use following code.
ILE.Setcurrentkey("Item No.","Location Code");
ILE.Setrange("Item No.","Item No.");
ILE.Setrange("Location Code","Location Code");
IF ILE.FINDFIRST THEN BEGIN
ILE.Calcsums(Quantity);
decQty := ILE.Quantity;
END;
You can use the decQty variable to display the required results.
Hi Rajat,
You are using the wrong trigger I guess. OnValidate() trigger works when there is a change in the field.
But the code looks fine, so if you are using this code on a Page, use OnAfterGetRecord() or OnOpenPage() trigger.
Hope it helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156