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!

Subreport section suppress formula not working with first record. 1

Status
Not open for further replies.

PhilB2

Programmer
Nov 6, 2003
133
US
A Subreport section suppress formula was not working with the first record, although the formula did work for a record further down. Someone suggested checking the Suppress checkbox, and that worked. Is there an explanation?
 
If you were passing back a Shared Variable, the value would not have been set until the section below the section containing the subreport.

If that's not it, please post the formula. A bit difficult to know wihtout it.



[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
If the value in the suppression formula as of the first record is null, the suppression formula does not execute and defaults to the value of the checkbox. So in this case, you are saying suppress the record if the suppression condition does not execute--this might not be what you want to happen in every case.

-LB
 
Subreport section suppression formula:

{@npItemID} = previous ({@npItemID}) or
{@npItemID} in {@CompareList}


@CompareList formula:

'"' + {?Pm-@Concatenate_ItemID_list} + '"'


@CompareList value:

"CUB10037A,CUB12322B,CUB12322B,
 
The following formula also doesn't work, even though all the conditions seem to be true; nor does the same formula work as a suppression formula for any of the detail report fields:

{@npItemID} = previous ({@npItemID}) or
{@npItemID} in {@CompareList}
or {@npItemID} = "CUB10037A"
or recordNumber = 1
 
You need to identify the location of the subreport and also show the content of all formulas including nested formulas. It is also unclear whether you are trying to suppress a main report section based on subreport results or just a section within the subreport.

-LB
 
The subreport is located in Group Footer #1a, although only Group Header #1 currently exists. I had tried placing the subreport in a detail section of the main report, but as I recall, there were too many records. (I don't know whether placing the subreport in Group Footer #2 would change anything.)

I'm trying to suppress just a section within the subreport.

Formulas and nested formulas in subreport detail section:
--------------------------------------------------------

Subreport section suppression formula:

{@npItemID} = previous ({@npItemID}) or
{@npItemID} in {@CompareList}


{@npItemID}:
if {VTMTRACK_EXSTREAM_APP.ITEMTYPE} = "Cub" then
{@npItemTypeDesc} + {VTMTRACK_EXSTREAM_APP.ISSUEID} + {VTMTRACK_EXSTREAM_APP.ID_SUFFIX}
else
{@npItemTypeDesc} + {VTMTRACK_EXSTREAM_APP.ISSUEID}

{@npItemTypeDesc}:
select {VTMTRACK_EXSTREAM_APP.ITEMTYPE}
case 'Cub' : "CUB"
case 'Incident' : "INC"
case 'Internal SSR' : "ISSR"
case 'SSR' : "SSR"
case 'ImageRight SSR' : "SSR"
case 'ImageRight Work Request' : "WR "
case 'ImageRight Cub' : "CUB"
case 'Work Request' : "WR "

@CompareList:
'"' + {?Pm-@Concatenate_ItemID_list} + '"'


Formulas and nested formulas in main report:
-------------------------------------------

@Concatenate_ItemID_list} (in Detail Section):
Shared StringVar IDlist := IDlist + {@ITEM_ID} + ","


@Declare_ItemID_list (in Group Header #2):
Shared StringVar IDlist :=
 
(I deleted unused section Group Footer #1b, so now there is only Group Footer #1.)
 
Please explain what you are grouping on in the main report and how the sub is linked to the main report (show the sub selection formula). Note that the placement of a sub should be based on the report logic, not on the number of records returned.

Are you trying to suppress a detail section in the main report?

Can you describe what the main and subreports are intended to do? We don't have context or enough info here.

-LB
 
There are two groups in the main report. The first is a column from a view. (The formula that produces the column is probably not relevant, but the column is obtained from a comma-delimited field beginning with a comma:

JOIN
teamtrack.ts_selections selectf on InStr(badgir.ts_dialogue_application, ',' || selectf.ts_id
|| ',') > 0;

The second group is a column from another view. Into that group goes a subreport.

Then there is a detail section, and the group 2 footer (suppressed).

Into the group 1 footer (possibly the group 2 footer would have been a better choice?) goes the subreport in question "no_pub"). I placed it in a footer because (as I recall) too much data appeared when I placed it in a detail section.

The record selection criteria for no_pub is:

{VTMTRACK_EXSTREAM_APP.EXSTREAM_APPLICATION} = {?Pm-VTMTRACK.EXSTREAM_APPLICATION} and
{VTMTRACK_EXSTREAM_APP.ITEMTYPE} in "SSR,Internal SSR,Incident,Cub" and
{VTMTRACK_EXSTREAM_APP.STATUS} = "Active"
//Do not compare with list from main report or report will hang up.

I put the comment in there because when I tried to add the condition to compare {@npItemID} with @CompareList (the variable from the main report, surrounded by quotes), the report hung up seemingly forever (I think I waited 1/2 hour before terminating it). Instead, I used the condition as a suppression formula in the subreport detail section:

{@npItemID} = previous ({@npItemID}) or
{@npItemID} in {@CompareList}


@CompareList formula:

'"' + {?Pm-@Concatenate_ItemID_list} + '"'


In the current report, @CompareList =

"CUB10037A,CUB12322B,CUB12322B,"
 
It could be becuase previous({@npItemID}) returns a null on the first record

try

(not onfirstrecord and {@npItemID} = previous ({@npItemID})) or
{@npItemID} in {@CompareList}

Ian
 
Thank you! That worked; I was able to uncheck the Suppress box using the modified formula. However, I don't understand why the first record would not be suppressed on account of the itemid being found in CompareList, independent of the first condition.
 
Crystal formulae do not like NULLs. As soon as they are encountered the formula fails. If there is ever a possibility that your formula will return a null make sure that you deal with that condition first.

Ian
 
Many thanks, IanWaterman. Thank you lbass and Madawc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top