This article is specifically for those who are new to using PDI and are facing difficulty in understanding how the variables behave when being passed from one job / transformation to another job / transformation.
PDI provides set variable component and get variable component to set and get variables in different jobs.
The First thing to keep in mind, is that the name of the variable being called using get variable component, should be the same as that of what was set in the set variable component. Any discrepancy in the names, and the variables will not be accessed by the next job / transformation, and the job will throw an error. Also, keep in mind that the variable names are case sensitive.
The Second thing to be careful about is, the data type of the variable being set and called later on. The data type of a variable should remain the same throughout the entire root job. Any variance will make the variable inaccessible further. For example, if ‘1200’ is being passed as a string initially, it should be treated as a string only and its type should not be changed to integer or bigint. This will corrupt the variable and make the entire process collapse. In case, such a conversion is needed, it can be made by parsing the string to an integer and assigning it to a new variable, and then the new variable is passed forward.
The Third and final point to be discussed here is the behaviour of default values of variables set during fetching a variable. If the value of a variable is to be pulled from the parent job, the variable should be declared, but its default-value should be left blank. If the default value is specified, it will override the variable value from the parent job and use the specified default-value only.
Keeping these points in mind while creating an ETL job will make sure that the job does not throw random, unwanted errors and will run smoothly.
Best Open Source Business Intelligence Software Helical Insight is Here