PDA

View Full Version : Expression help needed


ABC123

Jan Long
09-16-2000, 07:18 AM
I am using Alpha 5v1. I need a little help in building an expression. I have student classes whose field 'CLASS'is entered as 'P' which means 'Puppy', 'B' which means 'Beginners' 'AB' which means 'Advanced Beginners' etc. but I also sometimes have a second Beginner classes whose field 'CLASS' is entered as 'B2' for 'Beginners 2' etc. I am able to make the conditional expression that works as follows..IF(CLASS="P","PUPPY",IF(CLASS="B","BEGINNERS",IF(CLASS="P2","PUPPY2",IF(CLASS="B2","BEGINNERS2", ETC. ETC. then closing brackets. The problem is that the expression can only have I beleive 254 caricatures (sp?). The expression I need is larger then that so that on my reports and letters it will print the correct class. How can I do this without having to build two seperate reports with each having its own calulated field?

Jim Rowlen
09-16-2000, 05:28 PM
Make a calculated field for each value (or as many as you can fit in 256 spaces). Set it so that it doesn't match spaces are printed :
IF(CLASS="P","PUPPY ",IF(CLASS="B","BEGINNERS", replicate(" ", 9))
Make sure that each string has the same length and that you replicate enough spaces to have the same length.

On the reports, make sure each of these calculated fields have transparebt backrounds. Then just put the calc fields on top of each other. The spaces will let the value matching the condition show through. When you put the fields on the report make each lower one (in the pile) a little longer so you can get the one you want in the future for more editing.

Melvin Davidson
09-18-2000, 12:46 PM
Jan,

Jim's answer is an execclent idea, but I think I
have an easier, more dynamic way for you.

Instead of using an IF condition, just create
another db (CLASSES.DBF) with the fields
Name Type Width Indexed
CLASS CHARACTER 3 ascending
DESCR CHARACTER 20

Populate with the correct values
AB Advanced Beginners
B Beginners
B2 Beginners2
P Puppy

Then you can make a calculated field
something like

LOOKUPC( "F" , CLASS , "DESCR" , "CLASSES.DBF", "CLASS" )

In this, if you add another class, all you have to do is
just add it and the description to CLASSES.DBF

Regards,
Melvin

Jan Long
10-09-2000, 01:40 PM
Ok, I have tried this as it makes perfect sense, but with no luck. I guess I don't understand how to make them transparent. Would you be kind enough to explain.

Jan Long
10-11-2000, 12:28 PM
Jim, thank you for all your help. I was able to follow your directions and it does work great on reports. I am still having a problem when trying to do the same thing when writing a form LETTER. I can not get the expressions to become transparent. Do you have a suggestion I might try?
Thank you