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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case or formula 1

Status
Not open for further replies.

CrystaLv

Technical User
May 12, 2006
121
US
I am using field in Detail section that has
Phone
Fax
Email
Web

I want to display
Phone Number:
Fax Number:
Email Address:
Web Address:

But using If formula gives me 'boolean needed' error.
Any suggestions?

I can use Case statement in my view but I preffer not to.


 
Hi,
Please explain what the difference is..
It is not clear except for what looks like labels instead of data..

What is the data and how do you want to show it..not sure why any If or Case would be involved.

Also some basic info:
What database? connection type?
What Crystal Version?


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Using the View to process will prove faster, not sure why you prefer to embed rules in the client.

And why would you ask about a formula and not post what you tried? Post what you tried and where.

-k
 
I've wrote formula and placed it in Detail section
If ({table.field})'PHONE' then 'Phone Number:' or
If ({table.field})'FAX' then 'Fax Number:'

somehow I got Phone Number: displayed once but then it was 'boolean' message.

I am usind version9.

Thanks
 
Hi,
So, since you still fail to indicate what data is involved and your formula is not at all clear ( or even correct as far as I can guess - use 'If..Then..Else, not If Or If ), are you:
Checking the detail record to see if some field exists?
Wanting to Displaying a different text label depending on whether it is the Phone Or Fax data fie;d?

What are the data fields and what do you want to show??




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
This is data involved
Phone
Fax
Email
Web

Nothing else...string text field - that is it.

I need to turn it into Labels. Client wants to see 'Phone Number:etc.

 
Solved thanks to your question Turkbear!
It was else not or...
 
Hi,
I am assuming ( you seem reluctant to really describe the data structure or report layout) each of those is a field in the database that you want to display with a label:

So, 4 formulas are needed: each like this one
@ph
Code:
'Phone Number: ' + {phone}

I'll leave it to you to do the rest of them( you can add color tags if you want, or other formatting options),
then use the formulas, not the database fields in your details..
..

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I am not reluctant I just don't know how to describe data when this IS data - just what I posted. Thanks for your help, it all working after i got 'else' instead of 'or'.
If ({table.field})'PHONE' then 'Phone Number:' else
If ({table.field})'FAX' then 'Fax Number:' etc...

THANKS
 
Hi,
Data is described by showing its name and type like this Oracle example:
Code:
SQL> desc drop_me
 Name                                      Null?    Type
 ----------------------------------------- -------- -----------------------
 DF1                                                DATE
 TF1                                                VARCHAR2(75)
 NAME                                               VARCHAR2(30)
 STR2                                               VARCHAR2(24)
 STRCHAR                                            CHAR(10)

The formula you posted does not seem correct but if it is working for you that's all that matters.


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
OK,
then mine was

Comm Type

COM_TYPE String
______________________________

Com_TYPE looked like this in Details:
Phone
Fax
Email
Web

What seems to be wrong with my fromula?
It is like if i wrote SQL

SELECT DISTINCT
'COMM CODE' = CASE dbo.TABLE.COMM_TYPE WHEN 'Phone' THEN 'Phone Address:' WHEN 'FAX' THEN 'Fax Number:' END,
XXXXXXXXXXX

I just didn't want to mess up view because it used for many other reports. Am I still wrong with formula?

Thanks a lot for your time
 
Hi,
Crystal's normal syntax for that formula would be:
@showtype
Code:
If  {dbo.TABLE.COMM_TYPE} = 'Phone'
then
'Phone Address'
else
if  {dbo.TABLE.COMM_TYPE} = 'FAX'
then
'Fax Number'
You could also use Crystal's CASE function.
I see no comparison operators in your formula:
Is yours a SqlServer statement/function used in a command object, or maybe Basic syntax?


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Of course it was = 'Phone' not just 'Phone' sorry for confusion and thanks again for looking into my problem and solving it. Good Holidays!
 
Hi,
You too..I was glad to assist.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top