Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 2129

How to capture the latest status in a crystal formula

$
0
0

Hi All,

 

I have the following loop in my crystal report to calculate the days between when a First "In Progress" Status occurred in the data till the status went into a "On Hold" progress. .

 

 

 

shared numbervar diff;

shared datevar start;

shared datevar end;

 

 

if {NAME} = 'In Progress' then

    start := date({DATE_TIME})

else if {NAME} = ['On Hold', 'Fulfilled'] then

 

 

    end := date({DATE_TIME});

    if start <> cdate(0,0,0) then

    (

        diff := diff + DateDiff('d',start,end);

    );

    end;

)

 

I want to exclude the days between when the Status was "On Hold" to the Next "In Progress" and stop the counter if it encounters a "Fulfilled" status.


However, sometimes my data has multiple "Fulfilled" statuses and hence the code above doubles the days between for every time a "Fulfilled" status is encountered.


Here is an example:


DATE_TIME     Status               Days between as per formula

01/01/2016     In Progress               0

01/17/2016     Fulfilled                     17

01/17/2016     Fulfilled                     34    

01/17/2016     Fulfilled                     51

01/17/2016     Fulfilled                     68


Is there any way to modify my code above to calculate the days between only till the first occurrence of the "Fulfilled" status and stop the counter at that point?


Viewing all articles
Browse latest Browse all 2129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>