Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

condition in mapping

Hi All,

I have a question

How can i do a condition on mapping

i.e

i have column called 'Year' in table nad i have column called 'Future' in another table

what i want is to make this mapping

LOAD * Inline

[

Activity,Future

A,004

B,006

C,005

D,000

];

for Year=2009

and to make this mapping

LOAD * Inline

[

Activity,Future

A,003

B,006

B,005

D,004

];

for Year=2010

how can i do that??

1 Solution

Accepted Solutions
swuehl
MVP
MVP

So activity and future do only exist in your above two tables and you don't want a static mapping in the load?

What about a table like

LOAD * INLINE[

Year, Activity, Future

2009, A, 004

2010, A, 003

2009, B, 006

2010, B, 006

...

];

This should link your selected year to the appropriate Activity / Future combinations?

Well I think I misses your point, could you explain your data model and your business goal a bit more, please?

Regards,

Stefan

View solution in original post

5 Replies
swuehl
MVP
MVP

Hi Mona,

I think you could either use one mapping tabel, and combine e.g. Year and Activitiy as YearActivitiy to map, like

MapTableA:

Mapping LOAD * INLINE [

YearActivity, Future

2009A, 004

2010A, 003

2009B, 006

2010B, 006

...

];

and use applymap with a dynamical build YearActivity in the table you want to apply the mapping to,

or

use two mapping tables with distinct table name (MapTable2009, MapTable2010) and use a condition (if() / pick() ) to select the correct mapping table name for applymap.

I haven't tried nested applymaps as third idea (use a map to retrieve the mapping table name from given year), don't know if this works at all.

But first two ideas should work.

Regards,

Stefan

Not applicable
Author

Thanks Stefan,

But how can i combine Year with Activity

Year is a field name in the table How can i combine it with the column i will name??

Not applicable
Author

i want when i select the year i want

the correct mapping to be applied

swuehl
MVP
MVP

So activity and future do only exist in your above two tables and you don't want a static mapping in the load?

What about a table like

LOAD * INLINE[

Year, Activity, Future

2009, A, 004

2010, A, 003

2009, B, 006

2010, B, 006

...

];

This should link your selected year to the appropriate Activity / Future combinations?

Well I think I misses your point, could you explain your data model and your business goal a bit more, please?

Regards,

Stefan

Not applicable
Author

Thanks Stefan

i didn't know if there was available to make 3 fields in mapping but now i did know