Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace database values "true/false" with "yes/no"

Status
Not open for further replies.

ginkoba

Technical User
Jan 29, 2009
60
Is there a way to replace values in a database field? The database field is True/False and I want to replace them with Yes/No. About 25 records in all. How can I convert all of them?
 


Hi,

I'd venture a guess that the "values" in your database are NEITHER "TRUE" "FALSE" NOR "YES" "NO".

Rather they are perhaps 1 0 bit value and are merely DISPLAYING what you see. And TRUE/FALSE is much closer to what they actually mean, than YES/NO.

You can alwasy use a query to display something different.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
The values are actually True or False and I want to replace them with Yes or No on my report.
 
create a formula to place in your report instead of the database field something like this:

{@ToYesNo}
IF {yourtable.yourfield} = "True"
THEN "Yes"
Else
IF {yourtable.yourfield} = "False"
THEN "No"
Else ""

 
How can I include the 25 fields I have in the database with the same values in a single formula statement?
 
I am confused.

In your original post you stated 25 records, but in your last post you state 25 fields.

Which is it?

Do you want it to display 'yes' if any of the fields contain 'true'? what specifically are you looking for?

If you just have 25 fields each storing a TRUE/FASLE and you want to display each as YES/NO then you would need to create a formula to evaluate each field independently.

Sample data and a sample of desired output are always helpful to those trying to help.
 
Sorry about the earlier post. I meant fields and not records.

I want it to display 'yes' if any of the 25 fields contain 'true' and 'No' if any of the 25 fields contain 'false'.

Is there a way to have just one formula evaluate that?
 



BTW, there is a HUGE difference between replacing DATABASE FIELD values with REPORT VALUES.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
for display in a report, you would need a formula for each field.

this only changes how the information is displayed in the report.

As Skip pointed out there is a HUGE difference between changing the report values to be displayed and altering the values in the database.
 
You might be able to do a mass change of display by selecting all fields->format field->common tab->display string->x+2 and entering:

select currentfieldvalue
case true : "Yes"
case false : "No"

Not sure if your field returns a boolean with no quotes or whether it is a string with quoted true/false. Add quotes if necessary.

-LB
 
Thanks LB. I will try this solution and let you know.
 
Solution works LB. Had to modify it to the following:

select Cstr(currentfieldvalue)
case "TRUE" : "Yes"
case "FALSE" : "No
 
If that works, then I believe my suggestion should have worked. You have converted the field value to a string and then compared the result to a string. This tells me it was originally a boolean (not a string), and should have worked as is.

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top