Hello,
Is it possible to reference different variables with one AL statement?
For example, Label variables are defined like
Label01: Label 'aaaaa';
Label02: Label 'bbbbb';
Label03: Label 'ccccc';
And instead of referencing each variable with 3 AL lines, referencing like
Value := Labelnn;
(where nn is 01, 02, 03)
I have a feeling that this is not possible, but if anyone knows the solution to this, please advise.
Thank you!
Thank you, Zhu.
I will try as you advised.
Hi, yes, as Teddy said, it is not possible.
But if you want to reduce the number of variables, I think arrays are also a good choice.
For example.
Hope this will help.
Thanks.
ZHU
Thank you, Zhu. I should have been more specific.
What I wondered if I could do is to reference the label variables in one statement.
...
Label1: Label 'aaaaa';
Label2: Label 'bbbbb';
Label3: Label 'ccccc';
Name: Text;
n: integer;
...
for n := 1 to 3 do begin
Name := Labeln;
(do something using Name)
end;
...
So the name of the variable needs to be referenced "as variable", like "Labeln".
I guess it is not possible with AL and in the case above, I need to write the process for each Label variable (Label1, Label2, Label3).
Thank you, Teddy.
Hi, I think you can try the array.
A very simple example:
Hope this will help.
Thanks.
Don't really know why you want to do that.
Answer is no.
Sohail Ahmed
1,174
YUN ZHU
1,006
Super User 2025 Season 1
Mansi Soni
836