# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Rules, plus terms and conditions, can be found here.
Not applicable

## Create two conditions in the "Edit Script "

Create two conditions in the "Edit Script " QlikView, example:

I created one that has only one condition and it worked right

IF (NUM ([COD. COMPANY]) = 11, 'COMPANY 1 '
IF (NUM ([COD. COMPANY]) = 14, 'COMPANY 2'
IF (NUM ([COD. COMPANY]) = 18 '
COMPANY 3 ',))) AS WORK

BRANCH

I wanted one with two conditions that would look like this phenomenon, is cod. company = 11 and
cod.branch = 517 then COMPANY 517

if anyone can help me.

thanks

1 Solution

Accepted Solutions
Employee

## Re: Create two conditions in the "Edit Script "

Hello,

This syntax should work

`If(Num([COD. COMPANY]) = 11 AND BRANCH = 517,      517, // When condition is true     If(Num([COD. COMPANY]) = 11 AND BRANCH = 518, // When condition is false, nest a new If()          518,          'Other')) AS COMPANY`

Anyway, depending on your data model there might be some easier solution, probably using mapping tables, joins and so. Having complex conditionals may perform really poor and it make the script to take longer to load.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

5 Replies
Employee

## Create two conditions in the "Edit Script "

Looks to me like you need a comma at the end of the first 2 lines, and a value for when COD. COMPANY is not 11,14 or 18

Not applicable

## Create two conditions in the "Edit Script "

Try this:

IF (NUM ([COD. COMPANY]) = 11, 'COMPANY 1 '

IF (NUM ([COD. COMPANY]) = 14, 'COMPANY 2'

IF (NUM ([COD. COMPANY]) = 18 'COMPANY 3 ',

if(NUM ([COD. COMPANY]) = 11 and num(cod.branch) = 517 , 'COMPANY 517'

))) ) AS WORK

Employee

## Re: Create two conditions in the "Edit Script "

Hello,

This syntax should work

`If(Num([COD. COMPANY]) = 11 AND BRANCH = 517,      517, // When condition is true     If(Num([COD. COMPANY]) = 11 AND BRANCH = 518, // When condition is false, nest a new If()          518,          'Other')) AS COMPANY`

Anyway, depending on your data model there might be some easier solution, probably using mapping tables, joins and so. Having complex conditionals may perform really poor and it make the script to take longer to load.

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

Not applicable

## Create two conditions in the "Edit Script "

Hello Johan, I need two conditions even

Not applicable

## Create two conditions in the "Edit Script "

Thanks to all who somehow tried to help me, it worked just fine Miguel.