Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
josephinetedesc
Contributor III

if statement

Hi

this is what I want to do in QlkView script

IF(

condition1. if statusNumber <20, give stsNumber,

condition 2.  if statusNumber is null (or text - this picks up the NULL from SQL), give stsNumber of 0

condition 3. (if the date and the id number is the same), and (there are 2 or more statusNumbers) -, give the smallest stsNumber)

AS stsNumberGiven

The third conditions is the only condition where the there will be more than 1 statusNumber

Any help greatly appreciated - I have exhausted my skill set

Jo

1 Reply

Re: if statement

From what I understand, the below might be useful (you may need to adjust it based on your need):

Table:

LOAD yourFiels,

          statusNumber,

          stsNumber,

          date,

          idNumber

FROM Source;

Join(Table)

LOAD date,

          idNumber,

          statusNumber,

          Min(stsNumber) as MinstsNumber
Resident Table

Group By date, idNumber, statusNumber;

TableFinal:

LOAD *,

          If(Len(Trim(statusNumber)) = 0 or IsText(statusNumber), 0, MinstsNumber) as srsNumberGiven

Resident Table;

DROP Table Table;