# QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Not applicable

## If statement where buckets may overlap

 CUS ID CC Sav Cur 1 1 1 1 2 1 0 0 3 0 0 1 4 0 1 1 5 0 1 1 6 0 1 0 7 0 1 0 8 0 1 0 9 0 1 1

Logic is something like,

if CC = 1 then 'Cards',

if Sav = 1 and Cur = 1, 'Marked'

Please can you help with the correct IF statement for this. Some CUS ID's should end up with 2 values; ie they fall into both the Cards and Marked bucket

Thanks

Stu

1 Solution

Accepted Solutions
MVP

## Re: If statement where buckets may overlap

You need to create a link table, like

'Cards' as NewField

RESIDENT YourTable

WHERE CC =1;

CONCATENATE

'Marked' as NewField

RESIDENT YourTable

WHERE Sav=1 AND Cur =1;

7 Replies
MVP

## Re: If statement where buckets may overlap

You need to create a link table, like

'Cards' as NewField

RESIDENT YourTable

WHERE CC =1;

CONCATENATE

'Marked' as NewField

RESIDENT YourTable

WHERE Sav=1 AND Cur =1;

MVP

## Re: If statement where buckets may overlap

May be like this:

If(CC = 1 and Sav = 1 and Cur = 1, 'Both',

If(CC = 1, 'Cards', If(Sav = 1 and Cur = 1, 'Marked')))

MVP

## Re: If statement where buckets may overlap

Something like this?

Contributor III

## Re: If statement where buckets may overlap

use this

if(len(cards)<>0 and len(marked),1,0) as flag;

if( CC = 1, 'Cards') as cards,

if (Sav = 1 and Cur = 1, 'Marked') as marked

;

load * inline [CUSID,    CC,    Sav,    Cur

1,    1,    1,    1,

2,    1,    0,    0,

3,    0,    0,    1,

4,    0,    1,    1,

5,    0,    1,    1,

6,    0,    1,    0,

7,    0,    1,    0,

8,    0,    1,    0,

9,    0,    1,    1];

flag is 1 for not empty cards and not empty marked

Not applicable

thanks

Not applicable

## Re: If statement where buckets may overlap

Hi Sunny, thanks for the help but i needed multiple values for those Customers who appear more than once

Thanks for helping anyway.

MVP

Sounds good