Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Choosing inputs based on Lookup tables
DSPuzzles
Member Posts: 17 EDU
Suppose I have a parameter definition.table based on the following lookup table:
"Color"
"Reds"
"Light Red"
"Dark Red"
"Blues"
"Light Blue"
"Dark Blue"
Is there a way of having definition.table determine whether or not a second parameter shows up in the feature UI, based on whether the user selected "Reds" or "Blues"? I can only seem to find a way of doing it for the very last item in the tree ("Light Red", "Dark Red", ""Light Blue", "Dark Blue").
Thank you very much!
"Color"
"Reds"
"Light Red"
"Dark Red"
"Blues"
"Light Blue"
"Dark Blue"
Is there a way of having definition.table determine whether or not a second parameter shows up in the feature UI, based on whether the user selected "Reds" or "Blues"? I can only seem to find a way of doing it for the very last item in the tree ("Light Red", "Dark Red", ""Light Blue", "Dark Blue").
Thank you very much!
Tagged:
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565I think this is not possible right now. If you really need this functionality, you could take apart your lookup table and structure it as many nested "if" statements with their own dropdown menu, but this would remove the advantages (ease of creation, scalability, code reuse) that lookup tables gain you in the first place.
Possibly the best solution is just having the query always visible, perhaps with an error state set ( throw regenError("reason", ["queryParameterId"]) ) when one of the "Reds" is selected. This would indicate to the user that the feature needs the query filled out in this case, showing the "message" when they hover their mouse on the feature or the parameter.
5
Answers
I think so
Try something like this:
IR for AS/NZS 1100
Possibly the best solution is just having the query always visible, perhaps with an error state set ( throw regenError("reason", ["queryParameterId"]) ) when one of the "Reds" is selected. This would indicate to the user that the feature needs the query filled out in this case, showing the "message" when they hover their mouse on the feature or the parameter.
This topic is actually really important to me. I've been trying to find an efficient way to implement Kevin's suggestion. The UI of my custom feature is a high priority and I want to get more granularity with visibility conditions. The lookup tables will likely not change too much over time so I am okay with the loss of scalability this solution will incur. So we want to get to an end result like this:
IR for AS/NZS 1100
PhD, Mechanical Engineering, Stanford University