Loop Attributes Not Working for Attribute Name Containing Space

AustinT
AustinT New Altair Community Member
edited November 5 in Community Q&A
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. 

Best Answer

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee
    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
    jczogalla New Altair Community Member
    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. :smile: 
    Cheers
    Jan
  • AustinT
    AustinT New Altair Community Member
    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
    AustinT New Altair Community Member
    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
    Telcontar120 New Altair Community Member
    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  :)