Dear BPC Script Logic Experts,
I am new to script logic and need help with the logic below:
*LOOKUP SMUD_PLANNING
*DIM TOTALAT:AUDITTRAIL = HOURS
*DIM TOTALAT:CC_AT= 644PRO
*DIM TOTALAT:COST_ELEMENT= AVAIL_HRS
*DIM TOTALAT:BU_WBS_ORDER= AVAIL_WORK
*DIM EMPLOYEE_ID = NO_EMP
*DIM DETAIL = NO_DETAIL
*ENDLOOKUP
//Rec Calculates Consumed Hours Over/under Available Hours
*WHEN CC_AT
*IS = 644PRO
*WHEN BU_WBS_ORDER
*IS <> NO_WBS_ORDER,Y-NB-N-CC
*WHEN COST_ELEMENT.BEN_CALC3
*IS = "Y"
*WHEN AUDITTRAIL
*IS HOURS
*REC(EXPRESSION=-%VALUE%+LOOKUP(TOTALAT),BU_WBS_ORDER=Y-NB-N-CC,DETAIL=NO_DETAIL,EMPLOYEE_ID=NO_EMP)
//*REC(EXPRESSION=%VALUE%*LOOKUP(ATRATE),AUDITTRAIL=Input)
*ENDWHEN
*ENDWHEN
*ENDWHEN
*ENDWHEN
For the hours that are found in the When section above, the logic is performing too many comparisons to available hours (39 times it loops through in the example below - see the amounts in cells J03:J41). I would like the data aggregated in I03:I41 before it compares it to the value in the variable TOTALAT (which is showing in cell I02 for available hours) so that only one comparison of available hours to consumed (or planned) hours is made. I need the amount in cell I03 compared to I42 to create the record showing in row 48 versus the record showing in row 45 which is what the above logic is creating. Note the above example is just for one cost center activity type. Since the logic making too many comparisons with all of our cost center activity types, I limited the logic and my example to just one until it is working. Utimately, I need to have this calculate for roughly 500 cost center activity types. What are the options for aggregating by cost center activity type? Do I need more variables?
Thank you in advance for your assistance in script writing.
Sincerely,
Lisa S.