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

Null value parameter in subreport 1

Status
Not open for further replies.

LV

Programmer
Nov 1, 2000
1,184
US
I have a subreport linked to the main report by a string parameter(which is parameter in a stored proc that is behind the report). When this parameter has a value (or empty string), the subreport runs fine as expected. However, when in the main report I set the value of the linked parameter to Null, then my logic in subreport's record selection formula doesn't recognize this parameter as neither Null noe empty string. I created a test formula in the subreport, which will dipsplay a certain message based on the linked parameter passed:
Code:
if isnull({?MyLinkedParam}) then
  "null"
else
  if trim({?MyLinkedParam}) = "" then
    "empty string"
   else
    "has value"
This formula writes nothing is I set the linked parameter to Null, so it's neither Null, nor empty string or has any value. Any ideas?
 
Please post the record selection formula as in "then my logic in subreport's record selection formula doesn't recognize this parameter as neither Null noe empty string"

If the parameter passed is null, then it's likely that the subreport isn't running, which would explian why you aren't receiving anything from your test formula.

Where is the null parameter, in the main report SP or in the subreport SP?

Perhaps you can create a formula to use for linking instead of the main report, (however I don't understand why you'd want subreport data for blanks or nulls...) such as:

if isnull({?MyMainReportParm}) then
""
else
{?MyMainReportParm}

-k
 
synapsevampire,

Thanks for the reply. The parameter is in the main report SP; at the same time, it's used to link to the subreport. I don't want blanks in the subreport, I just need the subreport to recognize this parameter as null in the subreport record selection formula, which it doesn't seem to do now. Here is what the subreport selection formula looks like:
Code:
if( isnull({?Pm-?PROJ_NO}) or trim({?Pm-?PROJ_NO}) = "" ) ) then
   // get all records into subreport
   {sp_rpt_RW_317A_Sub01;1.PROJ_NO} = {sp_rpt_RW_317A_Sub01;1.PROJ_NO}
else
   // filter subreport records by proj no
   {sp_rpt_RW_317A_Sub01;1.PROJ_NO} = {?Pm-?PROJ_NO}
A test formula placed in the subreport looks like this:
Code:
if( isnull({?Pm-?PROJ_NO}) ) then
  "null"
else
  if trim({?Pm-?PROJ_NO}) = "" then
     "empty string"
  else
     "has value"
This test formula writes out nothing when the {?Pm-?PROJ_NO} is set to Null in the main report. But I definetly need to try your slution with a formula returning empty string to link to the subreport, instead of the parameter. Looks like a great work around, since en empty string is recognized in the subreport for sure.
 
...and it works like a charm. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top