Conditional check with variable

Conditional check with variable

Hi,
Im new to Talend, but old to Microsoft SSIS is there any component that resembles conditional split in SSIS.
i searched a lot but didnt find one.
The Scenario is this i have a single input task and 2 scd, one SCD does SCD type 1 and Other does SCD type 2
i need to control the flow of the input data with a variable. if the variable is 1 then it has to do only the SCD 1 operation
and 2 vice versa.
i too tried something no result, i also attached some images with this, Please have a look.

Thank you
Four Stars

Re: Conditional check with variable

maharaj.narayanan - can you show us a screenshot of your tMap mapping?
Four Stars

Re: Conditional check with variable

Hi,
If you have a variable for 1 and 2 in input data, then there is no need of tMap. Use tFilterrow and filter and reject record based on the value of variable. Connect scd1 and scd2...?
Using tmap also is simple to implement... filter data at the output for your variable 1 and 2, so flow will be allowed in respective output for scd1 or scd2 when input has 1 or 2 respectively.
But doubt is how you can have value of 1 and 2 in variable????
Vaibhav

Re: Conditional check with variable

Im not sure with this
Four Stars

Re: Conditional check with variable

I think you need to revisit the business logic and come up with some logical scenario for the business problem.
Vaibhav

Re: Conditional check with variable

The scenario is simple, i would like to have 2 scd component one for scd1 and another for scd2 by default it may be scd 1 loading strategy but if in future if i need to enable scd 2 i just need to change the variabe to 2.
that all
Four Stars

Re: Conditional check with variable

Solution is also very simple.
- Create a context variable context.select_scd as integer. Set its value to 1
- Use filter condition in tmap for 1 or 2 as per the screenshot
Thanks
Vaibhav

Re: Conditional check with variable

hi sanvaibhav,
Thanks a lot for the reply but this is what i too did but no data flows either way.
thats y i posted this question.
thankyou
Four Stars

Re: Conditional check with variable

Can you put the screenshot of your tmap.
I created a small poc to show it works. See two screenshots alternate when the value is swapped from 1 to 2
Vaibhav

Re: Conditional check with variable

Four Stars

Re: Conditional check with variable

What is the datatype of context.scd and what is default value?
Vaibhav

Re: Conditional check with variable

Integer.
Four Stars

Re: Conditional check with variable

and what is default value inside context editor window?

Re: Conditional check with variable

Thanks sanvaibhav.,
Found whats the mistake its the "Default" in value as tree, i created a new context in it thats y the job runs and data isnt flowing. now i changed the default value and it runs.

Thanks a Lot

Re: Conditional check with variable

and if u dont mind can i continue with one more doubt
Four Stars

Re: Conditional check with variable

If it is related to same topic, then pl continue... else mark this topic as fixed and open new one.
Vaibhav

Re: Conditional check with variable

Consider that i have a table with two field column 1 as job name and column 2 as scd strategy field
the thing i have entry of all the name of the job and how the loading should be done in this table
Now how do i fetch the corresponding value from that table to a variable for running that tmap as we discussed above
Four Stars

Re: Conditional check with variable

Use a query "select * from yourtablename where column_1 = 'jobName'". Here jobName is talend system variable. From this you will get column2 as scd strategy. Assign its value to context variable and then execute actual job. If your job names are not standardized as per talend job name then you will have to modify query accordingly so as to identify relevant job.
Vaibhav