Inserting the manually static values in tHashOutput

Seven Stars

Inserting the manually static values in tHashOutput

I have 4 values in context variable named as
1. Property
2. OCC
3. Agent
4. Reservation

And I am fetching multiple dates from tDBInput

Suppose we get 1 dates 20180710

I need to insert

Property_20180710
Agent_20180710
OCC_20180710
Reservation_20180710

In tHashOutput


How can I achieve this??

Accepted Solutions
Employee

Re: Inserting the manually static values in tHashOutput

Hi,

      It will not be complex if you take the base date also in the output flow as reference (screenshot below).

       Please note that I have taken the filedate as string from source itself (or you can convert in between stage). So concatenation will become easy.

 

      After that its pretty straightforward even if you are having multiple date records from source. 

      

       I hope this will resolve your issue.

 

Warm Regards,

 

Nikhil Thampi

 

image.png

 

 

 

Employee

Re: Inserting the manually static values in tHashOutput

Hi,

 

If the data in the other side is dynamic and if the date part is static, you always go for a tflowtoiterate to construct a loop and use append option in thashoutput to add additional data to Hash.

 

Warm Regards,

Nikhil Thampi


All Replies
Employee

Re: Inserting the manually static values in tHashOutput

Please try tDBinput-> tmap->thashoutput

 

a) In the tmap, add four output columns(for each context value) even though you are having single input date column

b) Convert the date to string in tmap and concatenate it with your context values.

c) Load the updated schema to thashoutput.

 

Note:- You can achieve the same using tjavarow also

 

Warm Regards,

 

Nikhil Thampi

Seven Stars

Re: Inserting the manually static values in tHashOutput

Differentiating context to different column makes this model complicated, I wanted to add these 4 context in a single column such that I can map them for multiple dates.
Example for 10th July 4 files must generate
For 11th 4 as well
And for 12th 4 as well
Employee

Re: Inserting the manually static values in tHashOutput

Hi,

      It will not be complex if you take the base date also in the output flow as reference (screenshot below).

       Please note that I have taken the filedate as string from source itself (or you can convert in between stage). So concatenation will become easy.

 

      After that its pretty straightforward even if you are having multiple date records from source. 

      

       I hope this will resolve your issue.

 

Warm Regards,

 

Nikhil Thampi

 

image.png

 

 

 

Employee

Re: Inserting the manually static values in tHashOutput

Hi,

 

If the data in the other side is dynamic and if the date part is static, you always go for a tflowtoiterate to construct a loop and use append option in thashoutput to add additional data to Hash.

 

Warm Regards,

Nikhil Thampi

Seven Stars

Re: Inserting the manually static values in tHashOutput

Thanks it works for me !
Employee

Re: Inserting the manually static values in tHashOutput

Hi,

 

Good to hear that you have resolved the issue.

Keep exploring Talend :-)

 

Warm Regards,

Nikhil Thampi