Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Cannot keep persistent variable value Post Reply Post New Topic
Author Message
LuisSantos
Newbie
Newbie
Avatar

Joined: 22 Jul 2008
Location: Australia
Online Status: Offline
Posts: 11
Quote LuisSantos Replybullet Topic: Cannot keep persistent variable value
    Posted: 22 Mar 2010 at 2:40am
I have a header and detail table.
Based on conditions, I may or may not print detail lines. Therefore I need to know when a detail line was printed in order to print related header line. Report looks like this:
 
GF2 - detail line 1a (printed)
GF2 - detail line 1b (printed)
GF1 - detail header 1 (printed)
 
GF2 - detail line 2a (no print)
GF1 - detail header 2 (no print due to no GF2)  
 
GF2 - detail line 3a (printed)
GF2 - detail line 3b (no print)
GF1 - detail header 3 (header line should print due to line 3a printed, but evaluation of controlling flag gets overriden at GF2 time)  
...
 
I tried to overcome problem by using a shared variables (in GF2) hoping that second time around "Shared StringVar ph" would retain it's original value:
 
// set flag to print header data
Shared StringVar ph;
//
// if not yet set to print from another task
if (ph = "N" or ph = "") and
({?Report Details} = "No Due Date" and s = "No Due Date") or
({?Report Details} = "Schedule" and s = "Due Now") or
({?Report Details} = "Tasks Closed" and s = "Task Closed") or
(
({?Report Details} = "Tasks Closed" and s = "Task Closed" and
   ({aualdocs.fmt_acc} <> Previous({aualdocs.fmt_acc}) or
    ({aualdocs.fmt_acc} = Previous({aualdocs.fmt_acc}) and {aualtask.rea_cde} <> Previous({aualtask.rea_cde}))))) or
({?Report Details} = "Overdue" and s = "Overdue")
 then ph := "Y"
 else ph := "N";
// set variable status
ph;  
 
Any suggestions will be much appreciated.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Mar 2010 at 4:17am

Hard to tell as I do not understand you design logic but basically it loks like you have conditions for each GF2 to print or not, from there you want the GF1 to print if any GF2 row also prints.

Logically then you can so this by usings a SUM.  For your GF2 logic apply a formula for "if print condition met then 1 else 0"
Now SUM that at GF1 level and condtionally suppress it where that Summary=0.
IP IP Logged
LuisSantos
Newbie
Newbie
Avatar

Joined: 22 Jul 2008
Location: Australia
Online Status: Offline
Posts: 11
Quote LuisSantos Replybullet Posted: 22 Mar 2010 at 2:40pm
DBlank,
 
You were spot on !!
I tried so many things I was getting tangled up, so I said to myself "I need a fresh look at this".
 
Thank you very much for your reply. Much appreciated.
Luis
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.