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

Creating a Formula to Mark Certain Records.

Status
Not open for further replies.

giggles7840

IS-IT--Management
Mar 8, 2002
219
US
I just did this but now i cant for the life of me figure out how!!!! OK, i want to create a formula(s) that will mark an X in my summary section if the detail records meet the specific criteria that i want.

Example:
GH1 - name city state
D1 - Credit
D2 - Title
D3 - Flood

But it should show:
PH - Name City State IsCredit? IsTitle? IsFlood? IsApprai?
GH1 - name city state X X X

and if there isnt a detail that matches those group headers then there shouldnt be an X....

Like I said I just did this a few weeks ago, but i accidentally blew that report away and now i cant remember how i did this. Please help! :)
 
Ok. You should have one detail section instead of 3 like your example above shows.
You need to create a formula for each spot that you want to have an "X" displayed.
Model each formula after the formula below, but change it to the appropriate field. You didn't say what tpe of field Credit, Title, or Flood was so I will assume that the field is a strind containing "Y" or "N".

@Credit
Code:
WhilePrintingRecords;
If {table.Credit} = "Y" then
    "X"
Else
    ""

~Brian
 
You haven't described what field(s) result in the Credit, Title, or Flood "X's". Is it one field and these are the options? Or are these different fields that can be null or not? If it is one field, then create formulas like:

if {table.field} = "Credit" then "X" else ""

If there are multiple fields, with results of null or not, then create formulas like:

if isnull({table.credit}) then "" else "X"

You can insert a maximum on these formulas if you are testing for the existence of any "X"'s within the group.

-LB
 
Close but not quite......
yes the Details that i described above is just one Detail section. sorry. The numbers that follow the D was to show that there were 3 records.....

GH1 - name city state
D - Credit
D - Title
D - Flood

The Credit, Title, and Flood, is data coming from the Bname field.

So, what i need is for IsCredit, IsTitle, IsFlood and IsApprai to be forumlas that represent the details above.

PH - Name City State IsCredit? IsTitle? IsFlood? IsApprai?
GH1 - name city state X X X

does that make more sense?

 
Assuming that there's a simple flag for the fields of interest, you might just create a formula for each in the group header, details and group footer section such as:

Group Header:
stringvar IsCredit := maximum({Detailformula},{table.groupfield})

Detailformula goes in the details, which you can hide:
whileprintingrecords;
If {table.credit} = "Y" then //(or whatever indicates it)
"X"
else
""

-k
 
there isnt a simple flag... {CustBusinessService.BusinessServiceNm} = Credit or title or flood or appraisal.

my first main formula to identify these four choices is:
if {CustBusinessService.BusinessServiceNm} = "Credit" then "C" else
if {CustBusinessService.BusinessServiceNm} = "Title" then "T" else
if {CustBusinessService.BusinessServiceNm} = "Appraisal" then "A" else
if {CustBusinessService.BusinessServiceNm} = "Flood" then "F"

Then i created 4 formulas to identify each "bucket":
WhilePrintingRecords;
If {@business name assignments} = "C" then
"X"
Else
""
and then the others follow the same logic... however, the results i get do not work. I do not get an X where I should. Its blank because its reading whatever record falls first into the grouping that i have set up.
 
I think you should create 4 separate formulas like the following and insert maximums on each:

if {table.field} = "Credit" then "X" else ""

-LB

 
when i try using maximun it says it can not create a running formula.
 
Giggles, post what you tried, and where you placed the formulas.

Try placing the formula in the details, right clicking it and selecting Insert Summary->Maximum

Now drag it to the Group Header

BTW, if you're not displaying the detail fields, you can just display everything in the group footer.

-k

-k
 
seriously it wasnt this hard the last time i did this.... sigh.

i have 4 formulas and if they are in the detail section then yes they work. but i need to hide/supress the detail section and want the "X" to show in the group header on one line. because of the way these formulas have been written Crystal will not allow me to do a count or Max on them.

@Credit
whileprintingrecords;
If {CustBusinessService.BusinessServiceNm} = "Credit" then
"X"
else
""

@Title
whileprintingrecords;
If {CustBusinessService.BusinessServiceNm} = "Title" then
"X"
else
""

@Flood
whileprintingrecords;
If {CustBusinessService.BusinessServiceNm} = "Flood" then
"X"
else
""

@Appraisal
whileprintingrecords;
If {CustBusinessService.BusinessServiceNm} = "Appraisal" then
"X"
else
""

now what....

 
if i take out the whileprinting records then i can do the max.
 
but it will only give me X's in my header if all 4 recs display. if only one record displays then i do not get an X in my header.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top