The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Use attribute values as attribute names
achint_kumar
Member Posts: 16 Contributor II
in Help
Hi All,
I am trying to automate one of the processes. Just like we can use macros as attribute names, is it possible to use attribute values as attribute names? Any expression for that?
For example: I am creating few Quarter & year concatenations dynamically based on dates for each row.
These are like: Q1_Y1, Q2_Y2,...................Qn_Yn
The values of these are: Q3_19, Q4_19.......................etc
Now, these values Q3_19, Q4_19 stored in Q1_Y1 Q2_Y2 are actually column names from the example dataset which i need to use for doing some filters dynamically.
Is it possible to use Q1_Y1 value as an attribute name using some expression? I tried using attribute(Q1_Y1) but it doesnt workout.
Please help.
I am trying to automate one of the processes. Just like we can use macros as attribute names, is it possible to use attribute values as attribute names? Any expression for that?
For example: I am creating few Quarter & year concatenations dynamically based on dates for each row.
These are like: Q1_Y1, Q2_Y2,...................Qn_Yn
The values of these are: Q3_19, Q4_19.......................etc
Now, these values Q3_19, Q4_19 stored in Q1_Y1 Q2_Y2 are actually column names from the example dataset which i need to use for doing some filters dynamically.
Is it possible to use Q1_Y1 value as an attribute name using some expression? I tried using attribute(Q1_Y1) but it doesnt workout.
Please help.
0
Answers
I think you could use Rename by Example Values operator...
Hope this helps,
Regards,
Lionel
Thanks for your response.
No, the above doesn't solve my purpose. The above operator we use for setting any row as column, but i need to pick the values from Qn_Yn variables and use that as Variable name for multiple different patientID (different rows).
The way we use macros as attributes, i neeed to use the attribute (Qn_Yn) values as attribute name since i already have Q1_19 etc columns in the datasets which i need to use on the basis of these values in variable (Qn_Yn).
I hope i'm not vague in my explanation.
Dortmund, Germany
Table 1: Contains 1, 0 as values for Quarter_Year variables. This i am fetching from the DB
In the same dataset, i have created new attributes which contains the actual Quarter_Year i need to use for my analysis. These i have created dynamically based on a date:
Based on the above values of variable , i need to use these values as variables so that i can fetch the 0.1 related to the respective Quarter_Year.
Hope this clarifies.
Thank you.
If you want to grab attribute names as macros, you can do this in a couple of ways:
1. You can use Loop Attributes. There is a parameter that sets a macro to the name of the attribute called "loop_attribute" for each loop iteration. You can do whatever you want (like filtering) inside.
2. You can transpose the ExampleSet so the attribute names are now a column, and use Extract Macro for whichever ones you want.
Does this help? I rebuilt your examples but could not get any further...
Scott