rickyProgrammer
rickyProgrammer

Reputation: 1167

Display record from Crystal Report Details Section to Group Footer Per Group

I have made a Crystal Report that group tenants per location. Each tenant are viewed by their current and previous month over all sales. There are instances where in a tenant's current sales status is CLOSED. What I need to do is filter all those tenant and put them in Group Footer PER GROUP / PER LOCATION. Currently I have a code that IS GETTING ALL the tenant's with closed status and display them in all pages.

Code:

Formula 1

 whilereadingrecords;
    stringvar strtitle;

    if ({@CurrentMonthNew}) = "CLOSED" and ({@PreviousMonthNew}) <> "CLOSED"
    THEN
    strtitle := strtitle + ">" + {spMSR;1.name}

Formula 2: the actual formula put outside section details as notes

evaluateafter({@notes});
stringvar strtitle;

How can I make the filtering per Location group. Please see this image for illustration of the report structure

enter image description here

Upvotes: 0

Views: 2179

Answers (2)

rickyProgrammer
rickyProgrammer

Reputation: 1167

Based from the useful answer of CoSpringGuy, I have come up to the correct answer that work really well to my problem

USE the 3 WAY METHOD FORMULA

Formula 1: In Group Header

Whileprintingrecords;
stringvar strtitle := "";
numbervar var :=0;

Formula 2: In details Section, the condition you want

Whileprintingrecords;

stringvar strtitle;
numbervar var;

if ({@CurrentMonthNew}) = "CLOSED" and ({@PreviousMonthNew}) <> "CLOSED"
THEN
strtitle := strtitle   + ChrW(13) + {spMSR;1.name}

Formula 3: In Group Footer, the actual to be shown on the report

whileprintingrecords;
stringvar strtitle;

Use whileprintingrecord instead whilereadingrecord to work the per group function of producing note.

Upvotes: 0

CoSpringsGuy
CoSpringsGuy

Reputation: 1645

UNTESTED There could be some typos but this should get you started assuming I understand your question.

Formula 1 // place in Group 2 header and suppress so you cant see it

    Whilereadingrecords;
    global stringvar notes = "";

Formula 2 // place in detail section suppressed so you cant see it

Whilereadingrecords;
global stringvar notes;
if {table.yearcurrentfield} = 'CLOSED' then Notes := Notes & " " & {table.Notes field}

Formula 3 // in group 2 footer not suppressed

global stringvar notes;

Upvotes: 1

Related Questions