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

Help with inserting a letter into a formula 1

Status
Not open for further replies.

Mimi143

Technical User
Dec 8, 2010
2
US
Does any one know how to write a formula that will select a letter based on the formula outcome?

Here is an example

If (Customer_code) = “HB” and (customer_state)= “CA” then “ I want to insert a full letter to the customer with the name of the customer and other demographic information out of crystal” Else If (Customer_code) = “HC” and (customer_state)= “CA” then “I want to insert a different full letter to the customer with the name of the customer and other demographic information out of crystal”
 
First, set up your tests as boolians, something like
Code:
(Customer_code) = "HB" and (customer_state)= "CA"
Then create a detail-line section that shows Letter 1. Right-click and choose the formula for suppression, put in the test not @Letter1

Do the same thing for Letter2.

That's assuming you want the letters mixed. An alternative is to do another Formula Field that chooses "Letter 1", "Letter 2" etc. and use it to group. Another - if the data is complex - is to separate one or both letters off as a subreport.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Maybe I’m not understanding something. It does not seem to work

First I set up tests as boolians, something like

CODE --> @Letter1
(Customer_code) = "HB" and (customer_state)= "CA"


I don’t quite understand this part
Then create a detail-line section that shows Letter 1. Right-click and choose the formula for suppression, put in the test not @Letter1

Do you mean a second detailed section on the report?


Here is what I have a report that that I run to check for positive test results on Patients. Whenever a patient has a positive result I need to send a letter. There are 7 different test and each test has a different form letter associated with it.

(Test_Code)=Hb and (Test_result)=”R” Get letter 1
(Test_Code)=Hc and (Test_result)=”R” Get letter 2
(Test_Code)=Hd and (Test_result)=”R” Get letter 3


I would like to run one report that would generate the letters for each positive patient so I could just mail them out. Each patient has a unique id.

Thank you
 
Insert a group on patient ID, and then add each letter to a separate detail section det_a,det_b, det_c. Then in the section expert, select det_a->suppress->x+2 and enter:

not(
{table.Test_Code}="Hb" and
{table.Test_result}="R"
)

Do the same with the remaining two letters, using a formula like above which will suppress the section containing the letter unless the code and result match.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top