OPTIONINDEX Example in Dynamic Pricing has "Delay" Problem

The example using OPTIONINDEX in the Knowledge Center article Implement dynamic pricing | SketchUp Help (Implement dynamic pricing) doesn’t work properly for me (SU 2015, Windows 7 64 bit, IE 11 update version 11.0.17); OPTIONINDEX appears to return the value for the previous entry instead of the current one. As an example, I added the attribute “Index” to the example optionindex_function.skp; see attached file optionindex_function_delay.skp.optionindex_function_delay.skp (539.4 KB) .

Is this a known problem, & is there a workaround (other than using multiple “ifs”)? Same seems to hold for OPTIONLABEL.

If this is a known problem, I recommend you update the examples, so others don’t spend the time required to investigate this (learning experience notwithstanding).

Thanks & sorry if I missed any previous answers.

James

2 Likes

I don’t know if its bad form to reply to myself before anyone else does, but…

I found a similar problem in another post, where it was a secondary issue (OPTIONLABEL(“material”) shows “delay”) to primary issue of OPTIONLABEL(“LenZ”) not working: OPTIONLABEL fails for LenZ .

However, the fix there (as I understand it, using an intermediate variable) appears to solve my problem also: optionindex_function_delay_workaround.skp (540.8 KB) .

I assume this has something to do with “order of calculation”, & would still like a more elegant fix if anyone finds one.

James

1 Like

the article is incorrect, first it shows cherry as the first in the list

then later it claims cork is first and cherry is second

1 Like

Hi! I’m encountering the same issue, I’d like to solve this but seems like I’m not able to download the skp file anymore.
Can anybody point me to the solution’ thanks in advance!

2 Likes

The issue in the example [Implement dynamic pricing | SketchUp Help] seems to be related to the predefined Material attribute. I don’t know what causes this, perhaps something related to its only being text-based.

A workaround to use the CHOOSE(OPTIONINDEX) function combination is to allow users to select a material from a custom attribute (ex. mat) AND generate a calculated result from that attribute index value. Then separately let the Material attribute get its value from the custom attribute’s text value.

See attached ex.

Implement dynamic pricing.skp (37.8 KB)