Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Labels (2)
4 Replies
Anonymous
Not applicable
Author

Which component is used to execute this query? what error are you getting? Can you please upload some screenshots of your job?
Anonymous
Not applicable
Author

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,
Anonymous
Not applicable
Author

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.
Anonymous
Not applicable
Author

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