Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8526

Re: Help with an Array to Filter Records

$
0
0

hi Trey,

 

you're on the right track with the new variable in the arraybuilder formula.

 

you may wish to use an IF statement that wraps up the majority of the formula though...this way the entire formula is either acted on or not depending on var et.  e.g. the following syntax...

 

whileprintingrecords;

 

stringvar d:= {OBI_EquipmentMaster.Description};

numbervar p:= {DriveProjectionAndCollectedTotals.ProcedureProjection};

numbervar pe:= {DriveProjectionAndCollectedTotals.ProceduresPerformed};

numbervar et:= {OBI_EquipmentMaster.EquipmentType};

 

stringvar array ad;

numbervar array ap;

numbervar array ape;

numbervar c2:= 1;

numbervar n:=0;

 

if et = 3 then

(


// 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

 

// tried to add filter for only certain equipment type - assigned to variable above

//if not (d in ad) and et=3 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;


);


Viewing all articles
Browse latest Browse all 8526

Trending Articles



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