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.
const string value as map key?
imants_smidchens
Member Posts: 63 EDU
Hi! I'm working on a featurescript that has a lot of maps for user inputs/calculations, and to keep things clean & organized, I've moved all the maps to a separate feature studio, which I then import.
To make things more robust & future proof, I'm defining some strings (which will be used in keys later) as constants, but unfortunately Featurescript insists that it can't find a key then.
for example:
If I use strings for the keys, it works fine, but changing them to variables, even when wrapped in parentheses, results in the Feature Studio that imports these tables saying "Map entry has no key"
supposedly this should be allowed....
any suggestions?
To make things more robust & future proof, I'm defining some strings (which will be used in keys later) as constants, but unfortunately Featurescript insists that it can't find a key then.
for example:
const a = "foo"; const b = "bar"; export const DemoTable = { "name" : "table", "displayName" : "table", "default" : (a) "entries" : { (a) : "chose foo", (b) : "chose bar", } }
If I use strings for the keys, it works fine, but changing them to variables, even when wrapped in parentheses, results in the Feature Studio that imports these tables saying "Map entry has no key"
supposedly this should be allowed....
any suggestions?
0
Comments
and a missing a semicolon at the end. Public doc version that shows the error?
So lookup tables specifically require their maps to be listed with literal string keys, not an arbitrary FeatureScript expression.