Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create a variable containing text & a field reference

Hello

I'm trying to set a variable containing the following:

vDim = 'Dimension_' & Axis

Where Axis refers to a field value either X or Y.

I can think of 3 options to create the variable with the assigned value:

1- In the script using the LET command

2- Directly in the variables overview window

3- Through a Set variable action in a button

The problem I have is that options 1 and 3 will store the result of the expression 'Dimension_' & Axis in the variable. Option 2 allows me to create the variable but I would have to re-create it every time the script is reloaded.

Any ideas of how to create the variable maintaining the expression and not the resulting value of the expression?

Thanks,

1 Solution

Accepted Solutions
Not applicable
Author

If you don't want the expression to be evaluated on the load, you can replace the ampersand with the Chr() function equavilent and the resulting variable will contain the ampersand.

Try:

Let vDim = Chr(39) & 'Dimension_' & Chr(39) & Chr(38) & 'Axis';


The Chr(39)s will put single quotes around Dimension_ and the Chr(38) will add the ampersand between them. The result of that expression should be:

'Dimension_'&Axis


You could also force spaces around the ampersand, but I don't think it is necessary.

View solution in original post

1 Reply
Not applicable
Author

If you don't want the expression to be evaluated on the load, you can replace the ampersand with the Chr() function equavilent and the resulting variable will contain the ampersand.

Try:

Let vDim = Chr(39) & 'Dimension_' & Chr(39) & Chr(38) & 'Axis';


The Chr(39)s will put single quotes around Dimension_ and the Chr(38) will add the ampersand between them. The result of that expression should be:

'Dimension_'&Axis


You could also force spaces around the ampersand, but I don't think it is necessary.