Solved Assign Dummy Value in Query (1 Viewer)

mfaisal.ce

Member
Local time
Today, 11:23
Joined
Dec 21, 2020
Messages
76
Dears,

i want to make a query with a criteria based on value of Field....

Table: Purchase
Field. ID
Field. Balance

I want to make a query in such a way that
1. Balance =0, output 0
2. Balance >0,output 1
3.Balance <0, output 2

Kindly guide....
 

plog

Banishment Pending
Local time
Today, 03:23
Joined
May 11, 2011
Messages
11,638
You want an iff statement:

CustomField: IFF(Balance>0,1, IFF(Balance<0,2,0))
 

mfaisal.ce

Member
Local time
Today, 11:23
Joined
Dec 21, 2020
Messages
76
This is not possible in Query statement??
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:23
Joined
May 7, 2009
Messages
19,230
select ID, Balance, Switch([Balance] = 0, 1, [Balance] > 0, 1, [Balance] < 0, 2, True, Null) As Output From [Purchase]
 

Isaac

Lifelong Learner
Local time
Today, 01:23
Joined
Mar 14, 2017
Messages
8,777
You want an iff statement:

CustomField: IFF(Balance>0,1, IFF(Balance<0,2,0))
IIF
 

Users who are viewing this thread

Top Bottom