Skip to main content

Hi I'm Srija, Solutions Consultant here at Ataccama.

In this post, I’ll walk you through how to use a dynamic expression assigner. 

What is a dynamic expression assigner?

The Dynamic Expression Assigner in Ataccama allows you to define dynamic expressions or rules to determine how values are extracted or assigned to specific attributes based on conditions present in your data. 

Use Case:

The Monitoring project results will give the attributes , Invalid DQ rules and Invalid DQ Attributes for the failed rows. If we need to extract the DQ Error Attribute Value based on the Invalid DQ Attribute then Dynamic Expression Assigner can be used in the post processing plan.

In the below example, I have a DQ_Error_Attribute which is causing the issue for that record. If I need to extract the respective value of the DQ_Error_Attribute then, I can use the Dynamic Expression Assigner.

 

We can achieve this using a column assigner, but we must hardcode the attributes to extract the value. If any new attributes are added to the source or a column name change happens then a hardcoded expression in column assigner will throw an error. In this scenario, we can make use of the dynamic expression assigner. 

How to use a Dynamic Expression Assigner in this scenario?

  1. Create a plan and use the text file reader step and consider the Excel table above as your Source.
  2. Add an Alter step to add a new column DQ_Error_Attribute_Value.
  3. Use the Dynamic Expression Assigner step, In the column give the DQ_Error_Attribute_Value created above using the alter statement. 

 

4) In the expression, give the DQ_Error_attribute so that the Dynamic expression assigner extracts the value of the attribute and stores it in the DQ_Error_Attribute_Value.

 

  1. Create a text file writer and store all the attributes. 
  2. The complete plan looks like below.

   


 

  1. Run the plan and see the output file. The excel file should contain a new attribute named DQ_Error_Attribute_Value. 

 

 

 

8. DQ_Error_Attribute value is extracted based on the DQ_Error_Attribute. In this scenario, DQ_Error_Attribute for ‘John’ is City. The actual value of the City is ‘Texas’. By using the Dynamic Expression Assigner step, The value of the city is extracted by passing the DQ_Error_Attribute in the Expression.

 

If you have any questions or thoughts please don’t hesitate to share them in the comments below! 

 

HI,

Is there any way to parse through a list of attributes ( colA|colB|colC) and output (‘A’| ‘ ‘ | ‘’) .  I can split and recombine was just hoping I may be able to parse the list then combine the results into one column for multiattribute tests.

 

I am just going to regex split → assigner → group .. no worries.. 

 

thanks,

 

gV


Hi @greglvaughan ,

I believe using regex split and assigning using the dynamic expression and grouping the columns is the best solution in order to achieve this.

Regards,

Srija Piratla


Reply