Technical support and scripting issues
Moderators: Dorian (MJT support), JRL
-
Grovkillen
- Automation Wizard
- Posts: 1128
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
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
-
JRL
- Automation Wizard
- Posts: 3524
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
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.
-
Grovkillen
- Automation Wizard
- Posts: 1128
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
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.
-
JRL
- Automation Wizard
- Posts: 3524
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
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
-
Grovkillen
- Automation Wizard
- Posts: 1128
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Mon Jul 26, 2021 4:58 pm
Ah! Might just do! Will try.