Greetings,
I would like to take an input from the user which is a year and i want the max accepted value to be taken from the general ledger setup table.
I added the maximum integer field in the general ledger table field:
field(50102; MaxYearForCommissions; Integer) { Caption = 'Max Year For Commissions'; DataClassification = ToBeClassified; }
and then proceeded by creating a field in the standard dialogue page where i want this integer to be added:
field(SelectedYear; SelectedYear) { ApplicationArea = All; Caption = 'SelectedYear'; //add max value here }
Things I tried:
GenLedgSetup: Record "General Ledger Setup"; MinimumValue: integer; MaximumValue: integer; trigger OnOpenPage() begin System.Clear(SelectedYear); // MaximumValue := GenLedgSetup.MaxYearForCommissions; (BC is crashing when running this code) end;
Thank you for your answer!
Even though I thought about this but I thought there would be a more straight forward answer that I did not consider.
trigger OnValidate()
begin
GenLedgSetup.get();
If SelectedYear > GenLedgSetup.MaxYearForCommissions then
Error('You have selected beyond the allowed year.');
end;
Thank you for your answer but i think I misled you with my question.
To rephrase it:
I would like the user to populate the Selected Year field of the standard dialogue but I want to set a criteria where the max value the field can take is equal to the integer entered in the general ledger setup.
Thank you!
*edit:Grammar mistake.
If I understood correct then you want to show the MaxYearForCommissions value of General Ledger Setup in the SelectedYear of the StandardDialogue page?
If yes then
trigger OnOpenPage()
begin
System.Clear(SelectedYear);
GenLedgSetup.get();
SelectedYear:= GenLedgSetup.MaxYearForCommissions;
end;
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,151 Super User 2024 Season 2
Martin Dráb 229,963 Most Valuable Professional
nmaenpaa 101,156