Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

SQL EASY QUESTION ?

I want this instruction  give me string result not Boolean value

Select  table1.booleanfield where table1.name=jone

What I want is : if booleanfield = true then the result of  instruction is ‘ good ‘
                           if booleanfield = false then the result of  instruction is ‘ bad ‘

I am waiting your  for your help .
0
peruzzi
Asked:
peruzzi
1 Solution
 
conconCommented:
Hi peruzzi,

what is your db? if sql/server :

select case(booleanfield
            when true then 'good'
            when false then 'bad'
            end) from table1 where name='jone'

Regards.
0
 
kretzschmarCommented:
there is a TBooleanField,
which should be automatically
assigned to your table-boolean field

there is a property DisplayValues
add there good;bad

meikl ;-)
0
 
wimmeyvaertCommented:
I think kretzschmar has it right.

Some more explanation :

If you doubleclick your TTable-Component in Delphi IDE, then do CTRL-F to add all fields linked to the Table you provided in TableName-property of your TTable.

Now you should see the BooleanField between all the other fields. Click on this field an go to the Object Inspector. change the Property 'DisplayValues' into good;bad.

If you now drag and drop this BooleanField from the FieldEditor (doubleclicking on TTable) to your Form, you should see 'good' if this field contains True and 'bad' if the field contains 'False' at runtime.

Hope I was of some help. Anyway the Kretzschmar had the right answer to your Q. I just tried to clarified the way of working.

Best regards,

The Mayor.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
wimmeyvaertCommented:
This also works for a TQuery-component !!
0
 
peruzziAuthor Commented:
Hi guys
wimmeyvaert , I choose your answer
I wanted to spilt the points between you and kretzschmar but I could not
so I choose the useful answer for me and give it the point.
 thank thanks for all
0
 
kretzschmarCommented:
hi peruzzi,

this is ok

wimmeyvaert explains it complete, so he earnes the points.
i'm not worry about this.

good luck again

meikl ;-)
0
 
wimmeyvaertCommented:
Hi all,

Kretzschmar, thanks you are ok with it.
It was not my intention to steel the points from you. I just explained in detail what you suggested.
Long live the fairness !!!

Thanks again,

The Mayor.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now