0

I have a requirement where I have a excel file, where there are four columns in the file. The image for the columns are attached.

Excel File Structure

I have created a simple job using tsystem componenent which creates folder in a specified directory. The parameter changes for the job is below :

Component Snip

The component is creating the required folders, but the requirement here is I will pass the values for the context variables folder and folder1 at run time, which needs to be mapped with the columns of the excel file i.e folder and folder1, and if it matches the value for the context variable initial_path needs to be provided the value of column Path from the excel.

Note the excel will have multiple rows but only one row would match with my inputs which I pass at runtime, hence each row should be read till the match is found.

How can i design this job.

Thanks in advance for the help.

user3454116
  • 184
  • 1
  • 12
  • tFileInputExcel-->tRowToIterate-->tJava (here you can apply your logic of whether for this row match is found or not..set some global variable)--RUN-IF-Trigger--->tSystem (uses values you set in tJava component) and also runs only when run-if condition is true – garpitmzn Apr 17 '16 at 02:34
  • Can you please provide the example java code that I should use for my requirement. Also as far as I know there is no component called tRowToIterate but we have tFlowToIterate. Is this the same component that you meant. – user3454116 Apr 17 '16 at 09:23
  • yes tFlowToIterate.. in the java code you have to do is below (first you have to uncheck the default basic setting in tFlowToIterate to allow you to define the keys which will be global variable. Then next you have to map these variables/keys to incoming columns from excel. Next in tJava code you can get these variables/keys using globalMap.get("key/variablename") and compare them to decide whether you have to append path or not and then you can set a flag and store it in another global variable using globalMap.set() and use it in Run-IF trigger – garpitmzn Apr 17 '16 at 17:37

1 Answers1

1

Thanks to inputs from @garpitmzn, I applied some code and was able to build the required job.

The job is below :

enter image description here

The java code that i aplied is below :

enter image description here

and then on the If trigger , I used the below logic:

context.folder == ((String)globalMap.get("path_dir"))

The completed my requirement.

user3454116
  • 184
  • 1
  • 12