How to use the output of tParseRecordSet as a lookup-Input for tMap?

One Star

How to use the output of tParseRecordSet as a lookup-Input for tMap?

Hello,
i have tMSSqlRow - tParseRecordSet - combination and want to use the output of the tParseRecordSet as input for a tMap.
The problem I have is the following:
The output of the tParseRecordSet should be a lookup input for tMap and not the main input.
Is there a possibility to use the output of the tParseRecordSet as lookup-input for tMap?

(The tMSSqlRow makes a select by using the value of a context-variable in the WHERE-Clause.
The resultset is passed to the tParseRecordSet. Now I have a "table" of the returned values and want to use this as lookup-input for a tMap.)
Many thanks in advance for any help.
Regards
Hartmut
One Star

Re: How to use the output of tParseRecordSet as a lookup-Input for tMap?

Hello,
I found a solution:
Instead of tMSSqlRow + tParseRecordSet I now use a tMSSqlInput.
But the reason why I could not use the output of tParseRecordSet as lookup-input for tMap was the following:
There was an OnComponentOK Trigger of another component pointing to the tMSSqlRow. It seems that the OnComponentOK Trigger can only be used in the main-input-flow of the tMap.
So when the OnComponentOk Trigger points to the component which delivers the main input for the tMap it works.
Regards Hartmut
One Star

Re: How to use the output of tParseRecordSet as a lookup-Input for tMap?

I found that solution, I hope it helps you...
I have that scenario

I define a var in tMap_1 in order to get the ResultSet of tMSSqlRow_2 through tParseRecordSet_1.

Then in tMap_2 I get each ResultSet filed value using Expressions like that: ((java.sql.ResultSet)row5.Resultado).getString("Producto")

Is there any better way to get that? I mean, not having to have a cast of each field using a map and java code. Also, these transformations are linked to the input row name of tMap_2 (row5) and if you want later to add a tReplicate between tParseRecordSet_1 and tMap_2 you have to remember to modify these expressions using the new row name what is not all desired.
One Star

Re: How to use the output of tParseRecordSet as a lookup-Input for tMap?

Hello aplicacions,
I have mapped the values of the recordset to the columns in the tParseRecordSet-component itself.
Regards Hartmut
Community Manager

Re: How to use the output of tParseRecordSet as a lookup-Input for tMap?

Hello guy
Just tell you how to use tParseRecordSet on 7942.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to use the output of tParseRecordSet as a lookup-Input for tMap?

Hello, thanks both for your proposals. Defining output columns within quotes in "Attribute table" worked me perfectly, so I can eliminate the unpolite code like ((java.sql.ResultSet)row5.Resultado).getString("Producto").
On the other hand, I'm not able to define the ResultSet variable in the tMSSqlRow_2 output schema. TOS gives me an error "The schema from the input link "out1\" is different from the schema defined in the component." I guess you could define the ResultSet variable in the output schema of the component because it was the first component of your scenario. However, I have a tMap_1 before the tMSSqlRow_2, hence why I used tMap_1 to define a new Resultado variable of ResultSet type. Is this the way I should to do that? Otherwise, I don't know where to define this ResultSet variable.
Thanks.
One Star

Re: How to use the output of tParseRecordSet as a lookup-Input for tMap?

Hello,
yes you are right, i defined the column of datatype "object" in the schema of the tMSSqlRow-component.
And i changed the datatype to "string" in the output schema of the tParseRecordSet-component.
Regards Hartmut