2022-06-13 10:49 AM - edited 2022-06-13 10:53 AM
Hello
I have a set of hideparameters that change depending on what option is checked (hope it makes sense)
Here i have an example in the parameter script:
IF no_shelf_1 = 1 THEN
HIDEPARAMETER "ShelfStyles_1"
HIDEPARAMETER "Shelf_1_Bottom_Limit"
ENDIF
IF no_shelf_2 = 1 THEN
HIDEPARAMETER "ShelfStyles_2"
HIDEPARAMETER "Shelf_2_Bottom_Limit"
ENDIF
IF no_shelf_3 = 1 THEN
HIDEPARAMETER "ShelfStyles_3"
HIDEPARAMETER "Shelf_3_Bottom_Limit"
ENDIF
As you can see in the example above, if I need to add more "IF no_shelf_x" then I have to modify the ShelfStyles_3 to ShelfStyles_x and Shelf_3_Bottom_Limit to Shelf_x_Bottom_Limit and it is a real pain to do it by hand.
So my question is if there is a better way to do this using loops for example?
Juan.
2022-06-13 02:17 PM - last edited on 2022-06-17 03:50 PM by Laszlo Nagy
Have "no_shelf" as an array parameter, so you can loop over all indices, then do some string manipulating:
for i=1 to vardim1(no_shelf)
if no_shelf[i] then
foo = "shelfstyles_" + str("%~", i)
hideparameter foo
endif
next i
2022-06-16 07:02 AM
Thank you, I will test it as soon as I get a chance. 😊