MDL> weirdness with array values
Moderators: JRL, Dorian (MJT support)
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
MDL> weirdness with array values
Why can't I get MDL to display more than one array element?
Let>k=1
Let>q=2
Let>mystring[%k%]=first
Let>mystring[%q%]=second
//this works
MDL>mystring[%k%]
//this works
MDL>mystring[%q%]
//but this displays mystring[1] mystring[2]
MDL>mystring[%k%] mystring[%q%]
??
Let>k=1
Let>q=2
Let>mystring[%k%]=first
Let>mystring[%q%]=second
//this works
MDL>mystring[%k%]
//this works
MDL>mystring[%q%]
//but this displays mystring[1] mystring[2]
MDL>mystring[%k%] mystring[%q%]
??
My belief is that the incorrect portion of your script is that which you believe is working. Anytime/everytime I work with arrayed variables I set the arrayed variable to another benign variable before use.
Let>k=1
Let>q=2
Let>mystring[%k%]=first
Let>mystring[%q%]=second
Let>value_k=mystring[%k%]
MDL>%value_k%
Let>value_q=mystring[%q%]
MDL>%value_q%
MDL>%value_k% %value_q%
I'm not certain when using one arrayed variable in a message started to work (I'm fairly sure it didn't in past versions) but any extra text will cause it to fail. Put any character, even a space, on the same line with the "working" message line and it will fail.
Let>k=1
Let>q=2
Let>mystring[%k%]=first
Let>mystring[%q%]=second
Let>value_k=mystring[%k%]
MDL>%value_k%
Let>value_q=mystring[%q%]
MDL>%value_q%
MDL>%value_k% %value_q%
I'm not certain when using one arrayed variable in a message started to work (I'm fairly sure it didn't in past versions) but any extra text will cause it to fail. Put any character, even a space, on the same line with the "working" message line and it will fail.
I believe it does work with array variables exactly the same way it works with other variables.I don't see any logical reason why MDL> shouldn't work with array variables as it does with any other variable.
Try this:
\\Your message will display "variable display"
Let>test=variable display
MDL>test
On the other hand if you add any other characters (a space for example), the variable buried in the text being sent to the message can no longer be deciphered so the message will display the word " test".
\\Your message will display " test"
Let>test=variable display
MDL> test
Of course if you want the value of the variable to be displayed, you can identify it as a variable by putting percents around it:
\\Your message will display "This is a test of message variable display"
Let>test=variable display
MDL>This is a test of message %test%
In the case of an arrayed variable, displaying the value requires percents around the sequential portion of the variable. As soon as you add other characters to the message text the program can no longer recognize what is plain text and what is an unpercented variable so the variable text is displayed rather than its value.
All that said. In my opinion the error, if there is an error, is allowing a variable's value to be displayed when it is alone in the message. It promotes discontinuity.
Hope this makes sense,
Dick
Greetings All,
Surely we'd want to keep this behavior the same for backward compatibility, old scripts must keep working.
Marcus, what do you make of all this?
That behavior has always been by design, per the example below from the Help File:JRL wrote:All that said. In my opinion the error, if there is an error, is allowing a variable's value to be displayed when it is alone in the message. It promotes discontinuity.
- Example
MessageModal>Hello World!
or with variables ..
Let>mymsg=Hello World!
MessageModal>mymsg
Then this must have been broken in version 8.0.4 because as per the Help File example, it should have displayed "variable display" i.e. the contents of the variable... not just "test".JRL wrote:I just checked on version 8.0.4 and the line sample:
Let>test=variable display
MDL>test
Will display the word "test". So, as I suspected, this issue is new to version 9
Surely we'd want to keep this behavior the same for backward compatibility, old scripts must keep working.
Marcus, what do you make of all this?
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
It depends on the content of the variable
Let>test=variable display
MDL>test
Returns "test" back to v7.something, but
Let>test=variabledisplay
MDL>test
Returns "variabledisplay"
As far as my testing goes, Message> has the same characteristics as MDL, so consider the Help example for arrays:
Let>Names[1]=Fred
Let>Names[2]=Sally
Let>Names[3]=Geoff
Let>k=2
Message>Names[%k%]
Returns "Sally".
To me that raises the expectation that there should be a way to use array variables in a message.

Let>test=variable display
MDL>test
Returns "test" back to v7.something, but
Let>test=variabledisplay
MDL>test
Returns "variabledisplay"
As far as my testing goes, Message> has the same characteristics as MDL, so consider the Help example for arrays:
Let>Names[1]=Fred
Let>Names[2]=Sally
Let>Names[3]=Geoff
Let>k=2
Message>Names[%k%]
Returns "Sally".
To me that raises the expectation that there should be a way to use array variables in a message.
That's weird. I just tested the following at ver 9.1.02:Me_again wrote:It depends on the content of the variable![]()
Let>test=variable display
MDL>test
Returns "test" back to v7.something, but
Let>test=variabledisplay
MDL>test
Returns "variabledisplay"
- Let>test=variable display
MDL>test
JRL says that under version 8.0.4 it will instead display just "test" and you say that behavior goes back to v7.something.
Could it be that in those older versions, the space inside the string of characters that makes up the contents of the variable: "test" is confusing the logic/parsing that goes on when the MDL> command is parsed? Perhaps this started happening when Complex Expressions were introduced?
In any case, it looks like this problem was found and fixed because it works like I would expect at 9.1.02. Marcus/Support, can you fill us in any further?
Well sure, we can set array variables. I think its only natuaral to want to be able to display them directly... without having to use the trick of first creating a new variable, setting it's value equal to the array variable and then using that new variable to display the value of the array variable.Me_again wrote: As far as my testing goes, Message> has the same characteristics as MDL, so consider the Help example for arrays:
Let>Names[1]=Fred
Let>Names[2]=Sally
Let>Names[3]=Geoff
Let>k=2
Message>Names[%k%]
Returns "Sally".
To me that raises the expectation that there should be a way to use array variables in a message.

If this is not possible, then at least document the trick in the Help File so users will know how to do this. I have not personally searched the Help File so if this is mentioned in there, I apologize in advance... but if its not, I think it should be added.
Thanks Me_again and JRL for your research on this. Take care all.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -

-
- Macro Veteran
- Posts: 260
- Joined: Fri Apr 15, 2005 8:32 am
Re:
Is it possible in 2022? I can't figure out how to display array elements in a message. Example:jpuziano wrote: ↑Thu Jun 07, 2007 2:03 amWell sure, we can set array variables. I think its only natuaral to want to be able to display them directly... without having to use the trick of first creating a new variable, setting it's value equal to the array variable and then using that new variable to display the value of the array variable.Me_again wrote: To me that raises the expectation that there should be a way to use array variables in a message.![]()
Code: Select all
ArrayDim>a,1
Let>k=1
Let>a_%k%=k
Msg>%a_k% = %k%
- Dorian (MJT support)
- Automation Wizard
- Posts: 1414
- Joined: Sun Nov 03, 2002 3:19 am
Re: MDL> weirdness with array values
Code: Select all
ArrayDim>a,1
Let>k=1
Let>a_%k%=k
Mdl>a_%k% = %k%
-
- Macro Veteran
- Posts: 260
- Joined: Fri Apr 15, 2005 8:32 am
Re: MDL> weirdness with array values
I was hoping to display the value of the array element (i.e. "1") rather than the name of the element (i.e. "a_1").Dorian (MJT support) wrote: ↑Fri Apr 22, 2022 4:31 pmCode: Select all
ArrayDim>a,1 Let>k=1 Let>a_%k%=k Mdl>a_%k% = %k%
So the example above displays "a_1 = 1". Is there any way for MS to display "1 = 1" instead w/o using an extra line and var? Thanks!
- Dorian (MJT support)
- Automation Wizard
- Posts: 1414
- Joined: Sun Nov 03, 2002 3:19 am
Re: MDL> weirdness with array values
No, you need the extra line.
-
- Macro Veteran
- Posts: 260
- Joined: Fri Apr 15, 2005 8:32 am