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

Recalling a Variable

Status
Not open for further replies.

Hillary

Programmer
Feb 15, 2002
377
US
I have the following variable in a formula...

Global StringVar DentalCredit4111;
DentalCredit4111 :=
If {deditems.dedcode} like "8760" then "$ 41.11" else

Global StringVar DentalCredit9961;
DentalCredit9961 :=
If {deditems.dedcode} like "8761" then "$ 99.61"

Group 2 is {deditems.dedcode}. Group 2 is split into two sections; A and B. Groups 2A and 2B suppress codes. Group 2B suppress all codes except "8760" and "8761". These 2 codes are what the formula are based on.

I want to recall (print on the form) the Dental Credit in Group 1. In Group 1 I want to either print "$ 41.11" or "$ 99.61" depending on {deditems.dedcode} in Group 2B

How do I recall (print on the form) the variable?

Thanks!!!!
Hillary

Hillary
 
Your formula should be something more like:

(you can omit 'Global', that's the default)
StringVar DentalCredit4111;
StringVar DentalCredit9961;
If {deditems.dedcode} like "8760" then
DentalCredit4111:="$ 41.11"
else
If {deditems.dedcode} like "8761" then
DentalCredit9961:="$ 99.61";

Now you don't state where your formula is, which is key, so please state specifics.

In looking at your requirements I think that your approach should be very different. Often times it's best to state your environment and requirements rather than stating a particular architecture to use.

You've posted here many times and know that solutions are based on your software and database version, neither of which you've shared.

Try placing something like the following in your record selection formula->record (the menu differs for different version s of Crystal):

{deditems.dedcode} in ["8760","8761"]

Now you don't need suppression.

And if you should only get one or the other as group 2, then group 2 isn't required at all.

Just place the field in group 1.

If you are getting both, and you're only interested if you've gotten one or the other, they can be referenced as:

minimum({deditems.dedcode},{table.group1field})

and

maximum({deditems.dedcode},{table.group1field})

-k
 
I've changed the formula and it is correct as long as I place the formula in Group 2B. Group 1 is employee number which is the section I want to print the variable fomula in.

Group 2A is medical info
Group 2B is dental info

Unfortunately, they need the dental info at the top of the form. I have already checked Underlaying Following Sections on Group 1 and Group 2A. So, the only way I know to get this dental info at the top (in Grouop 1) is to declare the variable.

I don't want to filter the record selection as you have suggested above because Medical codes are also used in this report (Group 2A)

CR 9.0

I'm still not sure how to recall this variable in Group 1.

Thanks for your help : )

Hillary

Hillary
 
I think you could create a formula:

if {deditems.dedcode} = "8760" then 41.11 else
if {deditems.dedcode} = "8761" then 99.61

Then you could right click on this formula in the detail section and insert a maximum on this at the Group #1 level. Then drag the result into the GH#1.

-LB
 
You might have to tweak LB's to use an aggregate function if so, try:

if {deditems.dedcode} = "8760" then
"41.11"
else
if {deditems.dedcode} = "8761" then
"99.61"
else
"N/A"

-k
 
This is what I needed : )

Thank you both for your help!

Hillary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top