One Star

tFlowtoIterate help

i have few contact rows in SugarCRM and i want to write them to ProWorkFlow using tRest component.
This is how i designed my job,
SugarCRM_Input ---main---> tMap ---main---> tFilterRow ---filter---> tFlowtoIterate ---iterate---> tRest
SugarCRM input brings rows and tMap sets few global variables to use in tRest. Rows are then filtered and they are converted from flow to iterate and lastly they are sent to ProWorkFlow one by one using tRest.
The issue with my job is that suppose i have 100 rows in SugarCRM and only one of them(say 5th row) qualifies to be written to ProWorkFlow. but tmap executes all the rows and global variables will not have the value of the correct row.
I thought that the solution is simple and i should just set global variables after tFlowtoIterate so that only one row at a time set the global variables and the values shouldn't change untill that row is sent to ProWorkFlow.
This is how i'm using global variables in tRest
<contactid>" + (String)globalMap.get("PWF_ID") + "</contactid> REQUIRED FIELD
<contacttypeid>1</contacttypeid> REQUIRED FIELD
<contactcategoryid>3</contactcategoryid> REQUIRED FIELD
<contactfirstname>" + (String)globalMap.get("FIRST_NAME") + "</contactfirstname> REQUIRED FIELD
<contactlastname>" + (String)globalMap.get("LAST_NAME") + "</contactlastname> REQUIRED FIELD
<contactworkphone>" + (String)globalMap.get("PHONE_WORK") + "</contactworkphone>
The issue is that i'm unable to set global variables after tFlowtoIterate. please help.
This is how i want my job to look like,
SugarCRM_Input ---main---> tFilterRow ---filter---> tFlowtoIterate ---iterate---> tMap ---main---> tRest
i'm using tMap to set global variables but obv any related component can be used to do it. i tried tsetGlobalVars but it didn't work.
let me know if failed to convey anything.
Seven Stars

Re: tFlowtoIterate help

I don't see why you should have a problem: even if tMap is processing all the rows, tRest will be executed for each row immediately after that row has been processed by tMap and so should use whatever tMap set. How do you know that the global variables do not have the value of the correct row?
Having said that, I don't understand how you're using tMap to set global variables? Usually, you would just use tFlowToIterate to do so, although you can also use tSetGlobalVar or tJavaRow. What did not work about using tSetGlobalVar?
Also, you don't need tFilterRow with tMap as you can filter either the inputs or the outputs directly in tMap but why not filter the records directly using tSugarCRMInput?
So, I think your job need only be:
tSugarCRMInput -main-> tFlowToIterate -iterate-> tRest
But to set the global variables after tFlowToIterate (even though that's not necessary), your job would look like:
tSugarCRMInput -main-> tFilterRow -filter-> tFlowToIterate -iterate-> (tSetGlobalVar OR tJava) (-iterate-> OR -OnComponentOK->) tRest