Home
Discussions
Community Q&A
Loop Attributes Not Working for Attribute Name Containing Space
AustinT
Hi RM and Community - working in Studio 9.0.001 and trying to utilize Loop Attributes to convert several attributes from Nominal to Date.
I experienced the error "Error evaluating expression: the function 'eval' failed to parse the subexpression 'Bus Unit'. Cause: extraneous input Unit expecting operator."
My process utilizes Loop Attributes over a subset. Inside the loop there is a "Generate Attributes" operator attempting to generate "%{loop_attribute}_new" via an expression to convert the string to a Date. I have selected a single attribute "Bus Unit" to identify the issue but my use case is to select several.
I have found when I loop an Attribute with a space in the name - "Bus Unit" in this case - the exception is thrown. When I choose a single attribute of either poly/nominal or real type and the name does NOT contain a space, the loop attributes works wonderfully as expected.
I think this is a bug - can I get some feedback/assistance? I will attempt to utilize the "rename by replacing" operator to see if this helps. However I wouldn't expect spaces in the Attribute name to be a nuisance to RM.
Find more posts tagged with
AI Studio
Loops + Branches
Accepted answers
Telcontar120
Spaces in attribute names are definitely a nuisance inside the expression editor. That's why in the current expression editor, attribute names with spaces are enclosed within square brackets. You could try doing the same thing with your macro, but probably the best solution is to strip out the whitespaces altogether with the Rename by Replacing operator.
All comments
Telcontar120
Spaces in attribute names are definitely a nuisance inside the expression editor. That's why in the current expression editor, attribute names with spaces are enclosed within square brackets. You could try doing the same thing with your macro, but probably the best solution is to strip out the whitespaces altogether with the Rename by Replacing operator.
MartinLiebig
Hi,
i think you need to use
#{loop_attribute}_new
but i am confusing myself here all the time as well.
@David_A
is the local expression parser ninja.
BR,
Martin
jczogalla
Hi,
I think Martin is half right. You can keep the %{loop_attribute}_new to create the name of the new attribute, but you can use #{loop_attribute} inside the expression to reference the macro as an attribute. But I think, I'd like David to conform it.
Cheers
Jan
AustinT
Hey gents, just wanted to update. I don't know why I can't crack the code on the names of attributes which RM likes. Also, the "#{loop_attribute}" syntax isn't correct unless I'm missing something obvious.
This error is so frustrating! Why would "Stnd_Hrs_Wk" not be a valid attribute name to include in a Loop Attributes??!
AustinT
Oops - quick follow up: looks like my previous renaming efforts introduced a space next to the underscore so the actual attribute name is "Stnd_Hrs _Wk" so that's not a huge surprise. I'll go back with fiddling with the rename and loops.
Telcontar120
Glad you found that because underscores should be fine inside loops, macros, and Generate Attributes. I use them all the time. But definitely not spaces
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)