Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Is it possible to have feature definitions toggle depending on whether a query is emtpy?

dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
I want to do something like this:

definition.selectedBodies is Query;
if ( isQueryEmpty(definition.selectedBodies ) ){
      definition.someOtherProperty is boolean;
}

IE, i want to provide some other inputs, but only if the user has entered a query that selects things.

I tried 

if ( definition.selectedBodies != undefined ){ 
....

but it appears that even when the user selects nothing, we get an empty query, not undefined ( unfortunate )

i know i can do this too:
but it kind of stinks beause the user has more clicks:

definition.doYouWantToDoWhatever is boolean;
if ( definition.doYouWantToDoWhatever  ){
     definition.selectedBodies is Query;
     definition.someOtherProperty is boolean;
}



Best Answer

Answers

  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    ok thanks for the info. i'll fiddle around and see what i can figure out
Sign In or Register to comment.