Quantcast
Channel: SCN : Unanswered Discussions - SAP Crystal Reports
Viewing all articles
Browse latest Browse all 4814

Help with an Array to Filter Records

$
0
0

Awhile back, I received some help (from Jamie) with an array that would look through records and summarize a total.

 

The formula is:

whileprintingrecords;

 

stringvar d:= {OBI_EquipmentMaster.Description};

numbervar p:= {DriveProjectionAndCollectedTotals.ProcedureProjection};

numbervar pe:= {DriveProjectionAndCollectedTotals.ProceduresPerformed};

 

stringvar array ad;

numbervar array ap;

numbervar array ape;

numbervar c2:= 1;

numbervar n:=0;

 

// check to see if the description has been added to the string array

// if not, add it plus add the initial projection value to the number arrays

if not (d in ad) then

    (

        numbervar c:= c + 1;

        redim preserve ad[c]; ad[c]:= d;

        redim preserve ap[c]; ap[c]:= p;

        redim preserve ape[c]; ape[c]:= pe;

    )

 

else

 

// if the description is already in the array, find its position

// then add the new projection as a running total to the appropriate number array values

(

    while c2 <= count(ad) do

        (

            if d = ad[c2] then (n := c2; exit while);

            c2 := c2 + 1

        );

    ap[n]:= ap[n] + p;

    ape[n]:= ape[n] + pe;

);

 

// grand running totals

numbervar gp:= gp + p;

numbervar gpe:= gpe + pe;

 

And this worked great but I'd like to modify it a little to only get records that match a certain type. As of now, I have EquipmentMaster.EquipmentType=3 in my Record Selection, which prevents records that do not have items with Equipment Type of 3 being displayed on the report.

 

So I'd like to remove it from the Record Selection and apply it to the Array so it only calculates this particular equipment type (3).

 

Is there a way I can move this into the array to handle the summaries?

 

Thanks,


Viewing all articles
Browse latest Browse all 4814

Trending Articles



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