I’m trying to show a text and for that I use the “IF” function. If the result you want to be TRUE or FALSE is written in quotation marks (“”) then Sketchup understands that this should literally be shown as a text, EVEN IF THIS TEXT CONTAINS THE COMMA SYMBOL, as shown in Figure 1. So far so good.
The problem is when I try to put another “IF” function within the existing “IF” function, the program no longer understands that the comma symbol (which is a text and is enclosed in quotation marks) should be literally written, and not that it is there to separate what is TRUE or FALSE. Figure 2.
“cama” in Portuguese (Brazil) means “bed”. Yes, Sketchup is not multi-lingual, but the program should still not understand the content of the “IF” function in one way and present another result at another time
It might be best to share the DC as there many ways to achieve a result, however you could use extra attributes to preserve your options like tam1, tam2,… sizes with comma.skp (20.3 KB)
This is a good alternative … but I am still intrigued as to why it sometimes works and sometimes not, since the mathematical operators and the logic of writing remain the same.
I created another Dynamic Component containing the exact problem I’m experiencing. I hope I have clarified my question and I will be very happy if anyone can help
IF bug.skp (123.7 KB)
Use the Component Attributescombined with the Component Opitions
It is because the DC extension is not a computer language like Ruby or C, it is an extension (written in Ruby) that evaluates user input and parses or tried to translate that into their built in methods or modules. Most likely it starts from left to right and gets confused if the output isn’t a number but text. It will then evaluate the ‘nested’ as text_to_number and use that outcome in the higher ones. We don’t know exactly, because it is not public.
1005/5000
Ok … this seems to be more complicated than I think it is …
I am experiencing other components with different problems of reading the attributes but similar to this one. For example: I use units in “cm” instead of “inch”, so far ok. When I tell the program that a certain attribute must be in “cm”, within the same sequence of 4 nested “IF” functions, 3 work but one of them is simply that the program does not recognize and does not return any results. I tried to change the units from “cm” to “decimal number” and then everything worked correctly. As a test, I also tried to write the same nested sequence containing the 4 “IF” but instead of using the criterion “= IF (Nnn! Nnn = 64, …)” I changed it to "= IF (Nnn! Nnn <64, …) “and now, even the program doesn’t understand the functions due to the fact that the units like” cm "it understood correctly and started showing the result I expected … I can’t understand it …
If you want, later I can make the component available for you