[resolved] pass tfileproperties schema to tmysqlinput

One Star

[resolved] pass tfileproperties schema to tmysqlinput

hi

how to pass tfileproperties schema value
dirname
size
md5
to tmysqlinput query
the flow is like as below
tfilelist----->iterate---->tfileproperties------>iterate------>tmysqlinput------>if--true---->tfilecopy
in query i want to give like this
select 1 from table_size where filename='"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"' and size= ;
for size i want tfileproperties size value to be passed. how to achieve it ???

And also how to pass this value "1" in query to a variable of tmysqlinput ,just giving a variable in the schema serve the purpose??

Accepted Solutions
Moderator

Re: [resolved] pass tfileproperties schema to tmysqlinput

Hi,
For infinite loop
You can design a job like that:
tInfiniteLoop (set some time) --------> tIterateToFlow --------> tRunJob
In your subjob(trunjob), put your workflow into
tfilelist---->iterate--->tfileproperties----->row(main)---->tflowtoiterate--->iterate--->tmysqlinput---->tflowtoiterate------>if---->tfilecopy
Even if your subjob (tRunJob) fails, it will loop back, hold on for a few seconds and re -run your job again.
That means you should create 2 separate jobs. One job for the tmysqlinput workflow and trigger of tfilecopy and the other one aim at loop.
Does it satisfy your requirement?
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.

All Replies
Moderator

Re: [resolved] pass tfileproperties schema to tmysqlinput

Hi,
If I understand you well, the query should be:
"select 1 from table_size where filename='"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"' and size="+row.size
Where is your value 1 come from? It is fixed or dynamic?
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: [resolved] pass tfileproperties schema to tmysqlinput

hi

the value one is fixed here ,the logic is this if select query has value for file name and size passed i shud get one else no value so . The row.size will it give tfileproperties size value ??
Moderator

Re: [resolved] pass tfileproperties schema to tmysqlinput

Hi,

The row.size will it give tfileproperties size value ??


To make it clear, I have designed a demo job.
tfilelist-->iterate-->tfileproperties-->main-->tflowtoiterate-->tmysqlinput-->tlogrow
See my screenshots.
Is it what you are looking for?
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: [resolved] pass tfileproperties schema to tmysqlinput

the row.size is not working and if i want to use if trigger condition for that value "one" returned from select query how to specify in java code in if condition code part . how to do it ??
Moderator

Re: [resolved] pass tfileproperties schema to tmysqlinput

Hi,
What's your expected result from tmysqlinput? And your condition(Run if.....)?It seems you want to trigger a subjob(tfilecopy) if there is a result returned(value one)?
For example:
I want to trigger the subjob if there is a/no processed row in workflow
Set the condition of RunIf:
!((Integer)globalMap.get("tMysqlInput_1_NB_LINE"))==0 or ((Integer)globalMap.get("tMysqlInput_1_NB_LINE"))==0

Could you give us more info about your current job and paste your job design screenshots into forum. There may be 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: [resolved] pass tfileproperties schema to tmysqlinput

hi sabrina

thank you for the reply i used what u said in if condition its working fine Smiley Happy
i changed the job as follows

twaitforfile--->iterate--->tfilelist---->iterate--->tfileproperties----->row(main)---->tflowtoiterate--->iterate--->tmysqlinput---->tflowtoiterate------>if---->tfilecopy

this is the query in tmysqlinput
select 1 from ETL_SIZE where filename='"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"' and size="+row2.size
in if condition
((Integer)globalMap.get("tMysqlInput_1_NB_LINE"))==1

its working fine but i want to run the job in infinite loop, if i connect tinfiniteloop to twaitforfile will it work or is it correct ??
Moderator

Re: [resolved] pass tfileproperties schema to tmysqlinput

Hi,
For infinite loop
You can design a job like that:
tInfiniteLoop (set some time) --------> tIterateToFlow --------> tRunJob
In your subjob(trunjob), put your workflow into
tfilelist---->iterate--->tfileproperties----->row(main)---->tflowtoiterate--->iterate--->tmysqlinput---->tflowtoiterate------>if---->tfilecopy
Even if your subjob (tRunJob) fails, it will loop back, hold on for a few seconds and re -run your job again.
That means you should create 2 separate jobs. One job for the tmysqlinput workflow and trigger of tfilecopy and the other one aim at loop.
Does it satisfy your requirement?
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: [resolved] pass tfileproperties schema to tmysqlinput

hi

yes , thank you sabrina for your suggestion
Moderator

Re: [resolved] pass tfileproperties schema to tmysqlinput

Hi,
Don't hesitate to post your issue on forum.
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.