how to use tParseRecordSet with dynamic columns

Six Stars

how to use tParseRecordSet with dynamic columns

hello,
I have a SQL query which looks like this: 
"select " +  context.fields + " from " + context.tablename
Each run can pass different fields and different tablename.
The resultSet is passed to tParseRecordSet.
I wan't to get the columns that I used in the select query (context.fields), but I get an error.
It forces me to put the exact columns (by name) I want to get.
Is there a way to fetch from the resultSet dynamically? 

Thanks
Community Manager

Re: how to use tParseRecordSet with dynamic columns

Which component is used to execute this query? what error are you getting? Can you please upload some screenshots of your job?
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: how to use tParseRecordSet with dynamic columns

The first component is tOracleRow with an object as a schema and contains the query:
 "select " +  context.fields + " from " + context.tablename
(context.fields = "id, name, address")
I want to read the resultSet without knowing the names of the columns and create a XML file from it (for example).
The tParseRecordSet can read a resultSet but in the attribute table I have to put the actual names of the columns - and I want to extract generic fields.
If it put context.fields in it, it get an error java.sql.SQLException: Invalid column name.
I know i can write a java code to do this, but if there's another way, it'll be great.
It seems odd that I can execute a dynamic SQL with no schema, pass the resultSet to another component, but unable to run through the resultSet dynamically.
At the moment, the job looks like this:
tOracleRow ------> tParseRecordSet ------> tLogRow
Attribute table:
column      |           value
-----------------------------
id              |  "id"
name        |  "name"
address     |  "address"
Thanks,
Community Manager

Re: how to use tParseRecordSet with dynamic columns

Yes, you have to input the value to map the real column name in the attribute table, it does not support context variable. To create a XML file, you still need to define the XML tree and configure the mapping between the column name and the element/attributes.
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: how to use tParseRecordSet with dynamic columns

Hi, I was wondering if there's any news regarding this issue. maybe in talend 6?
Thanks,