Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
moored08
New Contributor II

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

Re: If/ Then Statement with two different files

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

Re: If/ Then Statement with two different files

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

Re: If/ Then Statement with two different files

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

moored08
New Contributor II

Re: If/ Then Statement with two different files

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]

Re: If/ Then Statement with two different files

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

moored08
New Contributor II

Re: If/ Then Statement with two different files

Thank you, thank you, thank you soooo much!

That worked perfect!!