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.
how to trigger reportFeatureInfo in forEachEntity?
EvanReese
Member, Mentor Posts: 2,135 ✭✭✭✭✭
I'm using forEachEntity to iterate over a query. Some of the operations may fail and I want to let the user know when they do. It seems like reportFeatureWarning and reportFeatureInfo don't do anything when inside the loop. I also tried making a boolean variable isError outside the loop to change inside the loop, but inside the loop it's treated as a const, which I can't edit. How might I solve this?
Evan Reese
0
Best Answer
-
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭to get some value from pure function you can define a box container in the outer scope, then make a change to the box value in the function body, call the function and the value will be stored in the box - this is called closure:var b = new box("");// declearing box containervar f = function (){//do somethingb[] = "new box value"; // b[] - accessing box inner valuereturn "something"; // explicit return - may or may not exist;}//function callf();//now box will contain "new box value"println(b[]);
0
Answers