Choose Language Hide Translation Bar
Highlighted
lwx228
Level VII

How do I assign values to variables that are not pre-assigned?

For example, the variable "abc" is set in a global variable and assigned by other calculation procedures.
But since that calculation did not occur, there is no assignment of the variable "abc".
An error occurs when the variable "abc" is used later.
How do you assign a value to the variable "abc" at this point?

Thanks!

 

2020-07-23_17-08.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: How do I assign values to variables that are not pre-assigned?

You can use the Try() function or you can test to see 

if( isEmpty( abc ) == 1,  abc = 1 );
Jim

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

Re: How do I assign values to variables that are not pre-assigned?

You can use the Try() function or you can test to see 

if( isEmpty( abc ) == 1,  abc = 1 );
Jim

View solution in original post

Highlighted
Craige_Hales
Staff (Retired)

Re: How do I assign values to variables that are not pre-assigned?

Cool! I had not thought about using isEmpty on a non-existing variable. That's simpler and faster than the try() method.

Craige
Article Labels