One Star

Context variables for datasource settings

It is known that we can use context variables to configure connection parameters like file positions and database ID.
Is it possible to use context variables to switch other settings of the components, like switching between reading .xls and .xlsx format in a file input excel, or changing the table action of an oracle output between truncate table and default?
7 REPLIES
Moderator

Re: Context variables for datasource settings

Hi,
Is it possible to use context variables to switch other settings of the components, like switching between reading .xls and .xlsx format in a file input excel, or changing the table action of an oracle output between truncate table and default?

Do you want to set custom context variables both in option" Read excel 2007 file format (xlsx)". and drop-down list of "Action on table" or "Action on data" in t<DB>output component?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Context variables for datasource settings

Hi,
Is it possible to use context variables to switch other settings of the components, like switching between reading .xls and .xlsx format in a file input excel, or changing the table action of an oracle output between truncate table and default?

Do you want to set custom context variables both in option" Read excel 2007 file format (xlsx)". and drop-down list of "Action on table" or "Action on data" in t<DB>output component?
Best regards
Sabrina

Exactly. Is it possible?
Moderator

Re: Context variables for datasource settings

Hi,
Unfortunately, it is impossible to set context value both in option" Read excel 2007 file format (xlsx)" and drop-down list of "Action on table" or "Action on data" of t<DB>output.
What's your current situation? Maybe there is a better solution for your case.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Context variables for datasource settings

Dear Sabrina,
I want to read some excel tables and import the contents to a oracle table, and hoping to let users to choose whether their excel files are .xlsx or not, and also whether they want to truncate the oracle table or just append to it.
Regards
Michael
Moderator

Re: Context variables for datasource settings

Hi,
I want to read some excel tables and import the contents to a oracle table, and hoping to let users to choose whether their excel files are .xlsx or not, and also whether they want to truncate the oracle table or just append to it.

Does it mean the users cannot take the action (check out " Read excel 2007 file format (xlsx)", choose a proper action, update or insert, truncation) in studio directly? If so, how did you set the excel schema in tfileinputexcel for some excel tables?dynamic?
So far, users have to choose their excel files are .xlsx or not and set an appropriate one for table action and data action in DB.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Context variables for datasource settings

Hi,
I want to read some excel tables and import the contents to a oracle table, and hoping to let users to choose whether their excel files are .xlsx or not, and also whether they want to truncate the oracle table or just append to it.

Does it mean the users cannot take the action (check out " Read excel 2007 file format (xlsx)", choose a proper action, update or insert, truncation) in studio directly? If so, how did you set the excel schema in tfileinputexcel for some excel tables?dynamic?
So far, users have to choose their excel files are .xlsx or not and set an appropriate one for table action and data action in DB.
Best regards
Sabrina

The schema of the excel files will be identical, the only difference between will be their file formats, either .xls or .xlsx.
Moreover, I am hoping to deploy the job as a autonomous job so the users are neither required to install a TOS to perform the job, nor to compile the job every single time when they run it.
Seventeen Stars

Re: Context variables for datasource settings

The problem with the Excel data format can be solved by using the user components tFileExcel* suite from Talend Exchange. These components detect the type and handle it automatically.
You open a file with tFileExcelWorkbookOpen and read the sheets with tFileExcelSheetInput. This flexibility was one of the development goals for these components.
For the truncation of the table you could use a separate tOracleRow component and setup here your truncate command. In case of a particular context var is true you execute this and otherwise you skip over (all magic done by the if trigger).