How get table name in tmysqlinput

One Star

How get table name in tmysqlinput

Hello,
I have a problem for retrieve a name of table in a tmysqlinput.
I try :
context.table = globalMap.get("tMysqlInput_3" + "_TABLE_NAME");
But context.table is null.
Have you an idea ?
Thank
Seventeen Stars

Re: How get table name in tmysqlinput

The table name from the attribute does not matter. The only name what is real in use is the name of the table in the query. The query can be retrieved with:
context.query = (String) globalMap.get("tMysqlInput_1_QUERY");

I suggest you put the table at first in a context variable and use this var in your query.
The attribute TABLE you want to get is only in use for such things like Guess Query function.
One Star

Re: How get table name in tmysqlinput

Thank for answer,
However that doesn't work, the context.query is null..
I don't understand...
One Star

Re: How get table name in tmysqlinput

Did you change it to context.query = (String) globalMap.get("tMysqlInput_3_QUERY"); which seems to be your case?
One Star

Re: How get table name in tmysqlinput

Yes
One Star

Re: How get table name in tmysqlinput

I have try with other jobs but the var it's always null
Seventeen Stars

Re: How get table name in tmysqlinput

Open your job and take a look at the source code. You will find a put to the global map with the query.
When do you read out the query? This query is - per definition - available at the end of the flow, meaning you should get the query from the globalmap in a next subjob e.g. with a tJava.
One Star

Re: How get table name in tmysqlinput

Thank for the answer,
It's work ! Smiley Happy
If i understand, i can retrieve the table name after execution ?
If it's that, it's a bad new, because i require the table name before execution of query. In fact i check the status of table, if it's good i launch the query, if not good exit.
is it possible to retrieve the table name at the beginning?