Assigned command not working on dynamic variable names?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 695
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, Sweden
Contact:

Assigned command not working on dynamic variable names?

Post by Grovkillen » Thu Jul 22, 2021 10:06 am

Code: Select all

Let>VAR_1=hello
Let>VAR_2=bye
Assigned>hello_bye,TEST
//TEST=FALSE
Assigned>%VAR_1%_%VAR_2%,TEST
//TEST=FALSE
Let>%VAR_1%_%VAR_2%=Ok
Assigned>hello_bye,TEST
//TEST=TRUE
Assigned>%VAR_1%_%VAR_2%,TEST
//TEST=FALSE .... was expecting TRUE for one of these syntaxes...
Assigned>{%VAR_1%_%VAR_2%},TEST
//TEST=FALSE
Assigned>{"%VAR_1%_%VAR_2%"},TEST
//TEST=FALSE
Let>ME=%Script%

Running: 15.0.19b
version history

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 945
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Assigned command not working on dynamic variable names?

Post by Dorian (MJT support) » Thu Jul 22, 2021 10:40 am

I've marked this for Marcus' attention.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3401
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Assigned command not working on dynamic variable names?

Post by JRL » Mon Jul 26, 2021 1:20 pm

Grovkillen,
I'm confused as to what you're trying to accomplish. Nothing in your sample provides what I would call "dynamic" variable names. Concatenated perhaps. I think of dynamic as variable names the programmer doesn't know. User provided or from a file or from parameters for example. For the concatenated variables you would simply test each of the original parts of the concatenation.

Could you provide a more real world example of what you want? I'd like to help but as I said... I'm confused.

User avatar
Grovkillen
Automation Wizard
Posts: 695
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, Sweden
Contact:

Re: Assigned command not working on dynamic variable names?

Post by Grovkillen » Mon Jul 26, 2021 1:47 pm

I made an example as simple as possible just to keep it to the point. The thing is that I have dynamic variable assignment based on database values but as the example shows I cannot use variables inside the assigned command to see if a variable is assigned.

Further info: the script I'm writing is fetching data about football teams and for lower divisions there's not as much data and I want to do some checks to see if a dataset is assigned before pushing it into my own DB. If a value isn't assigned I need to set its value to null.
Let>ME=%Script%

Running: 15.0.19b
version history

User avatar
JRL
Automation Wizard
Posts: 3401
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Assigned command not working on dynamic variable names?

Post by JRL » Mon Jul 26, 2021 4:26 pm

Will something like this work?

Code: Select all

//Let>VAR_1=hello
//Let>VAR_2=bye


Let>VarTest=%VAR_1%_%VAR_2%
Separate>VarTest,%,TEST
If>Test_Count>4
  MDL>Not assigned
Else
  MDL>Assigned
EndIf

User avatar
Grovkillen
Automation Wizard
Posts: 695
Joined: Fri Aug 10, 2012 2:38 pm
Location: Hudiksvall, Sweden
Contact:

Re: Assigned command not working on dynamic variable names?

Post by Grovkillen » Mon Jul 26, 2021 4:58 pm

Ah! Might just do! Will try.
Let>ME=%Script%

Running: 15.0.19b
version history

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts