Hello everyone,
I have a question about a variable in a String.
Is it possible to write the “a” in the image below as a variable so that it can also be, for example, a “b”, “c”…etc?
Who can help me?
@Vikram_Subbaiah maybe?
Hello everyone,
I have a question about a variable in a String.
Is it possible to write the “a” in the image below as a variable so that it can also be, for example, a “b”, “c”…etc?
Who can help me?
@Vikram_Subbaiah maybe?
You would have to write it as 3 parts (string, variable, string) and combine them. That would let you control the variable separately. You can easily combine strings with a codeblock:
"string1" + var + "string2";
Hi Nick,
thanks for the response.
But I’m wondering if this does what I’d like.
Now where there is an “a” in the String is actually a question mark.
Kind of a Wildcard.
Can you show us what you’re actually trying to do? I don’t think you can use a wildcard in parameter lookups, but there are other ways to handle multiple parameters with varied names.
I want to get the parameter values of certain elements. But sometimes the parameter name can be “direction of rotation_a_type” and sometimes “direction of rotation_b_type” or “direction of rotation_c_type” etc.
So more of a Contain function.
Do you understand what I mean?
Yup. You wouldn’t be able to do this with GetParameterValueByName
, because it specifically looks up the parameter name, but you could get all the parameters from the element and search for strings containing your keyword. You could also get all variations of the parameter name from each element and then check for those that actually have a value with a nested If statement.
Hi Nick,
indeed that works.
Thanks again for helping out!