[Event Request] Codeunit 99000817 "Manu. Print Report".ConvertUsage
Describe the request
Please add new event
local procedure ConvertUsage(Usage: Option M1,M2,M3,M4): Enum "Report Selection Usage"
var
ResultReportSelectionUsage: Enum "Report Selection Usage";
begin
case Usage of
Usage::M1:
exit(ReportSelections.Usage::M1);
Usage::M2:
exit(ReportSelections.Usage::M2);
Usage::M3:
exit(ReportSelections.Usage::M3);
Usage::M4:
exit(ReportSelections.Usage::M4)
//---------------------------------------------------OnConvertUsageOnUsageElse:BEGIN
else begin
OnConvertUsageOnUsageElse(Usage,ResultReportSelectionUsage);
exit(ResultReportSelectionUsage);
end;
//---------------------------------------------------OnConvertUsageOnUsageElse:END
end;
end;
//---------------------------------------------------OnConvertUsageOnUsageElse:BEGIN
[IntegrationEvent(true, false)]
local procedure OnConvertUsageOnUsageElse(Usage: Option; var ResultReportSelectionUsage: Enum "Report Selection Usage")
begin
end;
//---------------------------------------------------OnConvertUsageOnUsageElse:END
Additional context
We need option run different usage and different report selection usage. Internal work item: AB#558147
The signature of the method needs to be changed too. We should drop the option definition in the code, and replace it with numbers. That would indicate to the code that it can be more options than 4. Option definition in method definition is wrong, we should delete all of these.
hello @nikolakukrika, I agree, but I do not know if we can suggest this kind of change. If you use integer it is OK for us. Enum with extensible=true can be too. Thank you
@fridrichovsky You can ask additional things, the point is to get a good design in place. My comment was more for the team that is processing requests. Defining Options inline is bad. If it is not possible to avoid an option as a parameter in the method signature, then it must not contain any member definitions. The risk is that we are duplicating the definition, it will be hard to keep all the definitions up to date if one of the values changes.
Hello @nikolakukrika, do you have any progress in this issue?
@fridrichovsky @nikolakukrika If we end up replacing the Option by Integer, can we not replace the whole procedure by a call to Enum.FromInteger()?
@attilatoury from my side it can be changed to Integer for before you change it to enum.
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.
Build ID: 35532.