I have an application that takes from 1 to 20 variables. The names of each of the variables are identical EXCEPT they end with a sequential number. From _1
to _20
.
For example:
Value_1, Value_2, Value_3...Value_20
What I'd like to do is:
- See if the variables exist first. There may be one variable or 20 of them. Furthermore, they are not guaranteed to be in a particular order. For example, only Value_15 might exist.
- For the variables beginning with
Value_
I'd like to check and see if they are null or not. - For those variables that are NOT NULL or EMPTY I want to get their values and feed them into another process.
I've heard using arrays might be the way to go. But I'd have to convert the variables found into an array...OR I could just interact over them from 1...20 and see if they exist and it they have values assigned to them, I could pull the value from each one.
What is the best way of doing this?