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: 
Anonymous
Not applicable

If/ Then Statement with two different files

Hi!

I was wondering if it was possible to have an if/then statement based on two different files.

I want a field from File A to interact with a field from File B in the script within an if/then statement.

Ex:

if (CW < [SW FSS], 'Low Avail', 'NONE') as Codes

LOAD

[Part number],
QW,
CW,
FROM
[\\Blah.xls]
(
ooxml, embedded labels, header is 1 lines, table is Report1);

LOAD

Plant,
[SW FSS)]
FROM
[\\1234ABCD.xls]
(
ooxml, embedded labels, header is 11 lines, table is Table);

Can someone help?

1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

Try this.

Data:

Load *, If ( [AvailCW2]< [SW FSS], 'Low CW Avail', 'NONE') as [Codes];


LOAD

[Part number],
[SW FSS)],

ApplyMap('Linking', [Part number], 'Null') as [AvailCW2]

FROM
[\\1234ABCD.xls]
(
ooxml, embedded labels, header is 11 lines, table is Table);

View solution in original post

5 Replies
Anil_Babu_Samineni

Try to club in single Table using ApplyMap() and then use same condition ?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

You will need to somehow Join (using Joins or apply map or lookup) bring the two fields into a single table and only then you would be able to perform your calculation

Anonymous
Not applicable
Author

So I completed the Apply Map function, but I need to also include an IF statement.

Ex: IF (CW < [SW FSS], 'Low Avail', 'NONE') as Codes

So so far I have my code as:

Linking:

Mapping LOAD

[Part number],
CW,
FROM
[\\Blah.xls]
(
ooxml, embedded labels, header is 1 lines, table is Report1);


Data:
LOAD

[Part number],
[SW FSS)],

ApplyMap('Linking', [Part number], 'Null') as [AvailCW2]

FROM
[\\1234ABCD.xls]
(
ooxml, embedded labels, header is 11 lines, table is Table);



I need the new field [AvailCW2] to have an if statement that references a second field [Codes].

If (([AvailCW2]< "[SW FSS]"), 'Low CW Avail', 'NONE') as [Codes]

settu_periasamy
Master III
Master III

Try this.

Data:

Load *, If ( [AvailCW2]< [SW FSS], 'Low CW Avail', 'NONE') as [Codes];


LOAD

[Part number],
[SW FSS)],

ApplyMap('Linking', [Part number], 'Null') as [AvailCW2]

FROM
[\\1234ABCD.xls]
(
ooxml, embedded labels, header is 11 lines, table is Table);

Anonymous
Not applicable
Author

Thank you, thank you, thank you soooo much!

That worked perfect!!