Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

execution of two conditions simultaneously in if

hi

is it possible to execute two conditions simultaneously in if ??

for example

i have a dimension name and measure salary in my chart....

i want to execute a expression

if(name='ram',sum(salary)and concat(name,'Y'))

This is just an example,i just want to know is it possoble????

7 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You mean like this?

     If(FiledName=somevalue AND FieldName2=somevalue, 'Result', 'No Result')

Celambarasan

Not applicable
Author

hi

Celambarasan,

If(FiledName=somevalue AND FieldName2=somevalue, 'Result'........????, 'No Result')

i know we can execute and before the ist comma in brackets....but i want to know after the ist comma and before second comma ,can we execute and??....i have made it bold to specify it....

one thing more what is a global variable and hpw can we declare it???

Miguel_Angel_Baeyens

Hi,

In QlikView all variables are "global" in the sense that, regardless where are they declared (either in the script or in the Settings menu, Variable Overview) they can be used in any object. You can use an input box to create constraints on a variable, so you control the input format, that for example the value is only numeric and so...

Hope that helps.

Miguel

Not applicable
Author

hi Miguel,

could you plz giv me an example of using the input box...with the steps.

I have never used the input box.

swuehl
MVP
MVP

vitulgaur,

please don't post identical questions multiple times, this makes it quite hard to follow the discussions.

The HELP says about an if() statement:

if(condition , then , else)

The three parameters condition, then and else are all expressions. The first one, condition, is interpreted logically. The two other ones, then and else, can be of any type. They should preferably be of the same type. If condition is true, the function returns the value of the expression then. If condition is false, the function returns the value of the expression else.

So you can use any valid expression in the then branch of your statement. For example, you can concatenate a sum and a text:

If(FiledName=somevalue AND FieldName2=somevalue, 'Result: ' & sum(salary), 'No Result')

AND is a logical operator and will just return true (-1) or false (0).

Hope this helps,

Stefan

Miguel_Angel_Baeyens

Hi,

It's all documented in the Reference Manual. Anyway, go to any blank space in your sheet, right click and select new sheet object, input box. When the dialog opens, select an existing variable or create a new one in the General tab, then go to the Constraints tab and select to fit your needs, for example, Standard, Integer. Click on Error Message and set any text to warn the user to input any integer number. Then click OK and you are done.


Hope that helps.

Miguel

Not applicable
Author

Hi Stefan,

I wil take care of it from now on and thnx for your solution.