3 Replies Latest reply on Apr 26, 2016 6:09 AM by Julio Moyano

# I need select records with two or three conditional

HI everybody,

I need to select records with condition variables.

for instance: I have two column (House and Age) and I need to create "type house"

 House Age Type house 20713 4 to 12 with kids 20713 13 to 17 with kids 10020 13 to 17 not kids 10020 18 to 24 not kids 33200 4 to 12 with kids 33200 35 to 40 with kids 13333 35 to 40 not kids

I need select:  IF house X  has Age 4 to 12 OR 13 to 17 = 'with kids'

ELSE 'Not kids'

Other examples: IF house X has not Age 35 to 40 OR 18 to 24 OR 13 to 17 OR 4 to 12  = 'wIth old people"

I need to select different houses according to people lives in there

Can you help me?

thank you!

• ###### 1. Re: I need select records with two or three conditional

Hi Julio,

As far as I can understand your question, all you need to do is create a calculated field for House Type based on the conditions you just mentioned. Then you can use this field as a quick filter so that the user could select the house type he is interested in.

Is this what you are looking for?

Thanks,

Rishabh

• ###### 2. Re: I need select records with two or three conditional

We can use the "And" or "Or " Operators in the "Conditional Statements.

Let me write basic query here.

if   ( [House]="1234" and [Age] ="1 to 10" ) or ( [House]="1234" and [Age] ="11 to 20" ) then "Grp -1"

elseif  ( [House]="1235" and [Age] ="15 to 25" ) or ( [House]="1236" and [Age] ="40 to 60" ) then "Grp -2"

........

end

another Example:

if (attr(Year([Order Date])) = 2011 and  sum([Sales])>10000)   (attr(Year([Order Date])) = 2012 and  sum([Sales])>15000)or  then "Good"

elseif (attr(Year([Order Date])) = 2011 and  sum([Sales])>20000)   (attr(Year([Order Date])) = 2012 and  sum([Sales])>55000)or  then "Better"

Best Regards

Kumar

• ###### 3. Re: I need select records with two or three conditional

Hi Kumar,

Thanks for you response. But I can't do it.

I wrote:

IF  [Codigo Hogar]= '280812' AND ([Tramo Etareo 2] = '4 a 12' OR [Tramo Etareo 2] = '13 a 17') THEN '1'

END

The variable are string

But in data base appear null

Other issue is I have many 'codigo hogar'. There is some form I can do this to every 'codigo hogar' once and not write for each one.

thank you!