Dynamics Nav C/AL all message in one

162 Views Asked by At

I have created a page that also outputs multiple messaages. Now the question, how do I make that the messages are all output in one message. Because now it is so that I have to click away every single message to see the full page.

I have thought to save the messages somehow then at the end of all output one below the other, but I do not know how to do that. Please help

if ...
   else
        Message('Day %1 is already present.', RecDate."Day");

and I have this several times

1

There are 1 best solutions below

0
On

It's not possible to capture messages or suppress them and show all at the end of the process. Probably you want to restructure the code to compile all the bits in a singe text line and display one message when the process completes. It would be something similar to this.

        var
            Dates: Text;
        begin
            if ...
            else
                Dates := Dates + '\' + Format(RecDate.Day);

            if Dates <> '' then
                Message('Dates already present:\' + Dates);
        end;

Besides, I would probably think about using a temporary table to store all those records that must be displayed in the message, because it can be really cumbersome if the number of records grows too big.