Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Suppress not working Post Reply Post New Topic
Author Message
musicman
Newbie
Newbie


Joined: 27 May 2014
Location: United States
Online Status: Offline
Posts: 5
Quote musicman Replybullet Topic: Suppress not working
     Posted: 28 May 2014 at 3:31am
I have a report that I need to suppress a field that does not print a specific variable. Let me try to explain. in my report in Group Header 2 i have initials of a user and the report compares a few code numbers and if they don't match I print Verify on the form for that specific clients initials in the Group 2 header. I have tried all combinations of suppression and I either get all initials or none regardless of the variable "Verify"

So what I want is if the report does not show verify (meaning codes match) then suppress the initials on the header, if the report prints Verify then show the initials in group header. When I use this in the suppress formula {@Verify-code} <> "Verify" I get no initials in the header if I use {@Verify-code} = "Verify" I get everyone's initials and most are blank pages because I only show the pages that have Verify. FYI I separate the pages so that only one Client initial is on a page... I hope I explained this well enough, I have been working this issue for a few days and cannot get it.
Example

DTM 5/27/14
8:30
Code 12345 service 134556   Verify
9:00
Code 12345 Service 12345     "" (this I suppress because no verify)
10:00
Code 12345 service 134556   Verify

---New Page-- These pages (initials) should not show because there is no verify this is where the problem lies how can I suppress these blank pages?
JEM

TGM

EMG

TAM
8:30
Code 12345 service 134556   Verify
9:00
Code 12345 Service 12345     "" (this I suppress because   no verify)
10:00
Code 12345 service 134556   Verify

Edited by musicman - 28 May 2014 at 3:49am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 May 2014 at 3:43am
you will have to explain your "verify-code" formula.
just placing initial in a group header means that it displays the initials from the first line in the group, it does not mean that those initals are the same for the entire group.
also,m if your copmparison is usinga running total or variable formula then you cannot use it to suppress a value in the header.
please give more details about the data set and what you are trying to accomplish.
IP IP Logged
musicman
Newbie
Newbie


Joined: 27 May 2014
Location: United States
Online Status: Offline
Posts: 5
Quote musicman Replybullet Posted: 28 May 2014 at 3:55am
Thanks for the fast reply DBlank. I edited my original post. My verify code is just if statements to compare 2 codes which that works perfectly. When the codes don't match I print Verify on the report. so what I want is if the report does not have Verify for one of the user initials suppress all data which it does but it still puts the initails on the top of the page, this is what I need to suppress is the initials in Group header 2 depending on the field (@verify) in the details. is Crystal hierarchical meaning I cannot suppress something in the header in relationship to a field in the details?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 May 2014 at 4:27am

it does things in passes but you cannot suppress a header based on details unless it is a summation of the details. If I understand you correctly you want to suppress the verbiage in the header if even 1 of the details in that group are matching

consider setting a summable value in a "flag formula" for the group and using that to suppress using a group condition
//flag
if codevalue1=codevalue2 then 1 else 0
sum this at the group footer
sum(flag,group)
now any group with a value>0 has an unverified record in it so you can use that as your suppression formula
sum(flag,group)>0
You can also use it to exclude the group from the report using it a group select criteria
IP IP Logged
musicman
Newbie
Newbie


Joined: 27 May 2014
Location: United States
Online Status: Offline
Posts: 5
Quote musicman Replybullet Posted: 28 May 2014 at 5:08am
Well sort of, I think :) but opposite if 1 of the details don't match I print verify (I want to show this) but for all the columns for that specific users initials have no Verify or the codes match I want to suppress that users initials I think what is happening when i put my suppress code in is that it evaluates True all the time regardless if I print Verify or not. if I use {@Verify-code} <> "Verify" (which is the text of a field I put on the form) I get no initials in the header (that means it is evaluating True all the time regardless of the @Verify-Code") if I use {@Verify-code} = "Verify" I get everyone's initials so it is evaluating false. Can I actually key off of a field by what is in the textbox? as you can tell i'm new to this. I am a VB and .Net developer but got placed on the Crystal project...
IP IP Logged
musicman
Newbie
Newbie


Joined: 27 May 2014
Location: United States
Online Status: Offline
Posts: 5
Quote musicman Replybullet Posted: 28 May 2014 at 5:38am
Thanks again DBlank for helping I really do appreciate it. Trying to explain is a little hard but I'll try again... here is the code I use for the @Verify-code
This is a very large SELECT statement so I truncated to one line.
SELECT {tbl.REASON}
CASE "44455 30"
:IF {CODE} = "55553" OR {CODE} = "58126" THEN ('')
ELSE
IF {CODE} <> "123456"
THEN 'VERIFY' //this prints verify on the report.

There are probably 50 users in the database all identified by their initials
and the code enumerates through each user in the database and on the report
prints verify for only those that match and I page break so that each user
is on their own page. what I am finding is that my suppress code evaluates
to True on all or to False on all so it does not seem to care what is in
the @verify-Code field on the report. I tried doing a rolling count but that
does not work... I am not familair with a flag formula but that may be the
way to go but I would have to count how many rows have the word Verify in the
@Verify-code textbox how could I accomplish this? it would also have to reset
after each record (or page) for the new users initails
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 May 2014 at 5:39am
your evaluation is only looking at the first row of the group.
the formula is a row level evaluation. Dropping fields into a header (or footer) really only display the values for that field from the first (or last in a footer) row of that group. 
Use what I was doing but make it make sense for what you want. YOU may have tweak it a bit.
 
--flag
if {table.codevalue1}<>{table.codevalue2} then 1 else 0
--Header Verify formula
if sum(flag,groupfield)>0 then "Verify" else ""
-- suppression formula
--this is just a true (suppress) or false (show) evaluation of the formula
sum(flag,groupfield)>0
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 28 May 2014 at 5:52am
note my suggestion is assuming that you are grouping on a field that has unique initials associated to it.
a flag formula is just a simple fomrula for falgging a row then summing it to flag the group.
from your last post it appears that you are not doing a row to row based comparison but simply need to know if a group has any rows with the a code of '123456' in it.
if my last post does not clarify how you can accomplish this, please post some raw detail level data, how you have it grouped and what you want to do with it sans any of your current formulas.


Edited by DBlank - 28 May 2014 at 5:53am
IP IP Logged
musicman
Newbie
Newbie


Joined: 27 May 2014
Location: United States
Online Status: Offline
Posts: 5
Quote musicman Replybullet Posted: 30 May 2014 at 2:37am
Thanks DBlank I took your advise to have a flag field and still no joy. What I did is use a running total and summarized on the @Verify-Code variable using a distinct Type Summary and I Evaluate for each record and reset on the change on Group ID (initials) which is great as the total changes with every different initial this gives me a count of either 1 or 2 so my suppress formula is {#RTotal3}= 1 (which I get a 1 if there is no Verify displayed on the page) so one would think it should suppress the initials but it still suppresses all the initials in that field regardless of the RTotal. I have tried {#RTotal3}<=1 also with no joy any help would be appreciated not sure why Crystal Reports has to be so difficult. Basically all I want is IF the Page has even 1 row with the word Verify show the initials of the user if the data for that users page does not have the word Verify on it then suppress the initials. I have it working for the data on the page so if there is a verify on the page then it is blank but for some reason trying to suppress the group header with the initials just wont work either is suppresses all or none. very frustrating but thanks again for your help on this...    
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Jun 2014 at 4:09am
running total only work in footers, not headers. you have to use a summarization like sum(field,group) in order to suppress something in a header
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum