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

Display all group header label in group formula even if no rows

Status
Not open for further replies.

sajisher

Programmer
Dec 3, 2003
45
US
Hi,

Working on CR 9. Creating a dynamic group header label with a formula '@groupLabel':

Formula @groupLabel:

if {table.column} = 12 then
" Level 1: One"
else if {{table.column} = 13 then
" Level 2: Two"

If there are no rows returned for {table.column} = 12, then the group label "Level 1: One" does not get displayed.

What is preferred is, even if there are no rows returned for {table.column} = 12, would want the group label "Level 1: One" displayed and print "NO Rows".

Report should look like
GH1 -> Level 1: One
NO Rows (in footer may be)

GH1 -> Level 2: Two
List rows


thanks
 
If you want the group to appear, there must be a value for it, so this is really about how you join tables. You need a table field to group on where all group instances are represented, and then add the second table with a left outer join and with no select criteria on the second table.

-LB
 
Hi,

I tried lbass suggestion, thanks. Have a 'Class' table with Id 12, 13,5, and 6. Second table 'Item' with ClassId 12, 13, and 5 but there is a selection criteria needed on the second table for the manager name. So I am not able to get header if ClassId is 12 but the manager name is different than the one given in critera. Any other logic I could follow?

With similar header formula, I have another report based on date difference. If the condition is not true, the header does not get displayed. Can anyone lend an idea which other logic I may approach please? - in a critical deadline.

@GroupHeader:

numbervar ageGroup;
ageGroup := CurrentDate - {table.PostedDate};

if (ageGroup > 3 and ageGroup <= 5) then
'Level 1"
if (ageGroup > 5 and ageGroup <= 15) then
'Level 2"
else if ageGroup > 15 then
'Level 3"

thanks
 
You could use a command as your datasource where you add the selection criteria in the 'From' clause--this preserves the left join:

select class.ID, item.managername
from (class
left outer join item on
class.classID = item.ID and
item.managername = {?Manager}
)

You could then group on class.ID and all IDs would be displayed.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top