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.
Default value for a lookupTablePath?
dave_cowden
Member, Developers Posts: 475 ✭✭✭
How do you set the default value for a lookup table path?
When i set up a lookupTable path variable, i expect the default value to be the one selected via the 'default'
clause in the lookup table itself.
But what i find is that the value is empty until the user chooses a value from it, at which point, it is populated.
What is the right way to ensure that the initial value of a lookupPath definition field is set to the default values initially displayed?
When i set up a lookupTable path variable, i expect the default value to be the one selected via the 'default'
clause in the lookup table itself.
But what i find is that the value is empty until the user chooses a value from it, at which point, it is populated.
What is the right way to ensure that the initial value of a lookupPath definition field is set to the default values initially displayed?
0
Best Answer
-
ilya_baran Onshape Employees, Developers, HDM Posts: 1,211The hole feature regen doesn't look at the lookup table. Only editing logic does and it only looks for changes to it -- and after the first change, the value passed in is correct.Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc5
Answers
print( definition.p ) would give { "choice1" : 'y' } ?
for me in both cases, and before any user click, definition.p would be an empty set. I'll make see if i can make a simple document to repro-- may example is way too complex to post, so it coudl have a bug too.
In my case, for now the workaround was to do something like this in the editingLogicFuntion:
var lookupPath = definition.path
if ( oldDefinition == {} ){
lookupPath = lookupPath ( { 'choice': 'p' } )
}
this allowed me to continue as if it was populated as I expected. but of course this code is brittle because it is a duplicate of what's already in the lookup table.