ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 99000817 "Manu. Print Report".ConvertUsage

Open fridrichovsky opened this issue 2 years ago • 7 comments

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

fridrichovsky avatar Nov 20 '24 15:11 fridrichovsky

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.

nikolakukrika avatar Nov 21 '24 20:11 nikolakukrika

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 avatar Nov 22 '24 06:11 fridrichovsky

@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.

nikolakukrika avatar Nov 22 '24 10:11 nikolakukrika

Hello @nikolakukrika, do you have any progress in this issue?

fridrichovsky avatar Feb 24 '25 13:02 fridrichovsky

@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 avatar Apr 14 '25 12:04 attilatoury

@attilatoury from my side it can be changed to Integer for before you change it to enum.

fridrichovsky avatar May 05 '25 13:05 fridrichovsky

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.

JesperSchulz avatar Jun 25 '25 12:06 JesperSchulz