0

Could not find much information about this. I can see that fields can have multiple copies per row in a transformation. But what are variables? Are they unique across all rows a transformation produces? But, by the name, variables are meant to vary.

What is difference between fields and variables exactly?

Can someone enlighten me please

Thank you

Akshay Lokur
  • 6,680
  • 13
  • 43
  • 62

1 Answers1

2

PDI transformations work with a stream of rows that pass through all the steps. The rows consist of a number of fields that the steps can act on, converting them, filtering them, sorting, etc.

Variables are more like a configuration help and have a single value in the transformation. It's very important to remember that they can NOT be set/changed and used within the same transformation, because all the steps execute in parallel!

Example

In your transformation you have a variable called "last_staging_run" and its value is "2017/01/19 05:00:00". This one has been passed to the transformation from the parent job.

You then use it in a Table Input: SELECT id, product_id, price, number FROM sales WHERE purchase_date > ${last_staging_run}

This will give you the new rows since the last staging run with the fields id, product_id, price and number. You might then lookup the product names or filter products with a zero price with other steps, then store it in a table again.

Cyrus
  • 2,135
  • 2
  • 11
  • 14