isoman4not5
isoman4not5

Reputation: 131

Show Last Record only if Condition Met

My report needs to show the last record of a client only if certain conditions are met. But I also need to still show a client who hasn't met those conditions.

The report currently shows clients that have been coded with 303 (only the last time) and those that haven't. But those that aren't 303 shouldn't show anything.

Client    Date          Process Code  

4         4/1/2017      303        
4         5/1/2017      101       
4         6/1/2017      303         

6         4/1/2017      101
6         6/3/2017      101

7         5/15/2017     303
7         5/28/2017     101

What they want to see on the report is:

Client      Date           Process Code
4           6/1/2017       303
6    
7           5/15/2017      303

How can I achieve this?

Upvotes: 0

Views: 2588

Answers (2)

dd4711
dd4711

Reputation: 799

  • Create a group for your client
  • Sort the records within that group by date descending (don't sort the group itself)
  • Print client details in detail block
  • Suppress details block if process code is not 303 or one detail row has already been printed

    • Add an additional Detail section after the existing one(s). Suppress it if you want to.
    • Place a formula @printed in the added Detail section, containing something like

      shared BooleanVar printed303; 
      if {Yourtable.ProcessCode = 303 then printed 303 := true;
      
    • Place another formula @reset in the group header containing something like

      shared BooleanVar printed303; 
      printed303 := false;
      
    • Add a Suppress Condition to your detail section containing somthing like

      shared BooleanVar printed303; 
      {Yourtable.ProcessCode <> 303  or printed303;
      

That should do what you described.

Upvotes: 1

4444
4444

Reputation: 3680

One option is to make shared variables that store the relevant fields when your Process Code = "303".

Whenever you change groups, reset the variables back to "". (You can do this by placing a formula in Client's Group Header.) Display these in your Client Group Footer with new formulas. If any 303's were found, the variables will display the latest value they captured. Otherwise, blank.

Upvotes: 1

Related Questions