Link to home
Start Free TrialLog in
Avatar of gbeattie
gbeattieFlag for Canada

asked on

Conditional Supressing in Crystal XI

I have a client who wants to supress some information that is printed on pay stubs for their employees.

The problem is that when she prints their paystubs, there are 3 columns with amounts. Pay period, Year-To-Date and Balance amounts.. Under the Balance column there are different rows that print. But there is a specific amount that she doesn't want to show up. I can't supress the Balance column as it will supress other useful information. The same goes for supressing a row, I don't want to suppress the entire row, just the amount under the balance column for that row.

I've attached a picture that I just created to help illustrate my issue. If you're looking at the picture, what I want to do is to supress BAmount3. I don't want to supress anything else. So everything else listed under the Balance column should still be visible, and everything else listed in the Earning3 row should be visible.

Is there a way this is possible?
Supressing.bmp
Avatar of Neranel
Neranel
Flag of United States of America image

On each field you can add a conditional supression, return 1 or true to supress and 0 or false to show.  I mainly use Crystal 10 so my screenshot wont help you much.
Avatar of Mike McCracken
Mike McCracken

Try this idea using conditional suppression

Right click the field
Click FORMAT FIELD
Click the COMMON tab
Click the FORMULA BUTTON to the right of suppress
Enter a formula like this using the value she wants suppressed
CurrentFieldValue = 564.92

mlmcc

Avatar of gbeattie

ASKER

The problem with that mlmcc is that the value is never the same. This is a paystub that's continuously changing every pay.
then set a parameter field, and supress conditionally based on @field = ?param
Do you always want to suppress that field or just when it is a certain value?

Does that value change for each record or just for each run of the report?

mlmcc
And how do you know what value you want supressed?
mlmcc: I always want to suppress that field, it doesn't matter what value it is. Since this is a paystub, the value is different every 2 weeks and this report is only ran every 2 weeks. So the value changes every time they run the report as well as for each record.

Neranel: If there is a value under that specific column and that specific row (Earning3, Balance) I always want that value supressed. I don't know what the value is before hand.
If you never want to see the value then right click the field, click on "Format Field".  Go to the Common tab and click the check box next to "Suppress"

or

If you never want to see that value, just remove it from the report.
Another way if you need is to set the color to WHITE or the background color.

mlmcc
Alright, it looks like most people on here are trying to be very helpful, and I appreciate that very much. But I guess I did a terrible job explaining my situation. I wanted to avoid this, but here is the crystal screen and the paystub that I want to modify.

Crystal Screen
The BALANCE that's highlighted red is only 1 field, but it may have numerous amounts associated with it.

Paystub screen
On the paystub, I do not want the Balance column suppressed nor the "Other" row. What I want suppressed is the 19.27. It will never be the same, it will always change because this is a balance that keeps increasing every pay.

Looking back at the Crystal screen though, it looks like I can only either suppress the row or the column, which isn't what I'm looking to do.

Please take a look and let me know if I need to do a bit more explaining.

Thanks.
Crystal.JPG
paystub.JPG
Can you identify the row when you are in it?

You could conditionally suppress the balance column like

{EarningField} = 'Earning3'

mlmcc
Do you ever want to see a "Balance" in the "Other" category?

In not, right-click, Format Field, Common tab

next to suppress there's a formula button.
try putting

{cmpName} =  "Other"

in the formula box. . .
(can't see the whole field name there)
Next to supress there should be a check box to alwasy supress just that single field, if thats what you want.  If only sometimes. youll need to hit the formula button and devise a bolean formula to tell the system when to supress, return true or 1 to supress, and false or 0 to show.
Alright, if we take a look at the paystub screen. I want to see 801.85, but I want to suppress 19.27.

Is that possible?
Yes, see my prevous post, open the format for the field you want to supress.
could you upload the report file?, What version of crystal is it?
You will want to see do a conditional supression based on the earning/ded/tax i would gather.  

if {earning/ded/tax} = '6% Accrual/6% V' then
    formula = 0
else
    formula = 1
end if
What does '6% Accrual/6% V' have to do with anything? Either way, here's the report. It's in version XI.

Thanks.
cpcheck1-m.txt
ASKER CERTIFIED SOLUTION
Avatar of Neranel
Neranel
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Wow, that's exactly what I was looking for!

Thank you so much.
Actually, we ran the report on the company's live data and we have a problem. =(

Vacation Balances are not showing up on the employee pay stubs.  However, anyone earning 6% is showing up, but everyone else's is blank.

Is there any way to fix this?
Change my condition supression to be be
if {CPPCKD.SHORTDESC} in ("6% Accrual/6% V", "next to show up", "Next to show up", "etc.") then 
    formula = false
else
    formula = true
end if

Open in new window

Also if you could check the key for this instead of the text, that would be better practice.
if {CPPCKD.key field} in (3, 5, 6, 7, 8) then 
    formula = false
else
    formula = true
end if

Open in new window

Thanks, but where do I go to modify the conditional suppression?

Also, can you elaborate a bit more on the second post? I'm not sure I understand the meaning behind the numbers.

Thanks.
Here is some screenshot to get to the code.  The second post is simply if there is a key value you can look at instead of a string of text, while both work, keys are much cleaner and dont break if you rename your description in your system.
EEUpload.pdf
Would I be able to flip the formula around? As in:

if {CPPCKD.SHORTDESC} = "SICK ACCRU/SICK" then
    formula = true
else
    formula = false
end if

Would that just supress only the Sick accrual and show everything else?
Yes that would work.
Haha!
Isn't that a lot easier than the other way around? =)
All you needed to say is I dont want it to show up for the Sick category and the rest to show, and that would be what i did.
When dealing with conditional supression or record selection formulas do this.

1. Find the simplest logigial pogression to decide whether or not to show a field (or record, or section, or group)

2.  Most of these will fit into a standard If Then Else statement or a Select Case satement.

3. if that does not work, try linking more than 1 IF or CASE statement together to meet your needs.
for instance a more complicated if then statement would look like this.  There are easier ways to do what this one does, but in the context of the report this field is in its required to be done this way.
GLOBAL xperiod as number
GLOBAL xyear as number
IF tonumber ({tglSegmentCode.AcctSegValue}) in array (10, 20, 50) then
    IF xperiod >3 then
        IF month ({tarInvoice.PostDate}) >3 THEN
            if  month ({tarInvoice.PostDate}) <= xperiod then
                IF year ({tarInvoice.PostDate}) = xyear then
                    formula = CCur({tarInvoiceDetl.ExtAmt} - {tarInvoiceDetl.TradeDiscAmt})
                else
                    formula = CCur(0)
                END IF
            ELSE
                Formula = CCur(0)
            END IF    
        ELSE
            formula = CCur(0)
        END IF
    ELSE
        IF month ({tarInvoice.PostDate}) >3 THEN
            IF year ({tarInvoice.PostDate}) = xyear - 1 then
                formula = CCur({tarInvoiceDetl.ExtAmt} - {tarInvoiceDetl.TradeDiscAmt})
            else
                formula = CCur(0)
            END IF
        ELSE
            if  month ({tarInvoice.PostDate}) <= xperiod then
                if year ({tarInvoice.PostDate}) = xyear then
                    formula = CCur({tarInvoiceDetl.ExtAmt} - {tarInvoiceDetl.TradeDiscAmt})
                else
                    formula = CCur(0)
                end if
            ELSE
                Formula = CCur(0)
            END IF    
        END IF
    End If
ELSE
    Formula = CCur(0)
end if

Open in new window

That formula displays a value but the same logic applies.