User Tools

Site Tools


examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
examples [2017/06/27 14:05]
plp_admin [Example 4 — Break Level Processing]
examples [2017/06/27 14:09] (current)
plp_admin [Example 5 — Computed Breaks]
Line 256: Line 256:
    // Now we process the arrays using the "PlpComputeBreak" project method for computing    // Now we process the arrays using the "PlpComputeBreak" project method for computing
    If (PL_ProcessArrays ("PlpComputeBreak";$breakArrays;$dataArrays;0)=0)    If (PL_ProcessArrays ("PlpComputeBreak";$breakArrays;$dataArrays;0)=0)
-   // 4th parameter is 0 for each break or 1 for each row +    // 4th parameter is 0 for each break or 1 for each row 
-   // Now TbreakText_R has been populated by PlpComputeBreak: concatenate breaks into a text variable +    // Now TbreakText_R has been populated by PlpComputeBreak: concatenate breaks into a text variable 
-   vBrkComputeResult:="" +    vBrkComputeResult:="" 
-   For ($i;1;Size of array(TbreakText_R)) +    For ($i;1;Size of array(TbreakText_R)) 
-   vBrkComputeResult:=vBrkComputeResult+TbreakText_R{$i}+Char(Carriage return) +     vBrkComputeResult:=vBrkComputeResult+TbreakText_R{$i}+Char(Carriage return) 
-   End for +    End for 
-   SET TEXT TO PASTEBOARD(vBrkComputeResult) // or do something else with vBrkComputeResult+    SET TEXT TO PASTEBOARD(vBrkComputeResult) // or do something else with vBrkComputeResult
    End if    End if
-   Here is our PlpComputeBreak callback method.+    
 +Here is our PlpComputeBreak callback method. 
    C_LONGINT($1;$2;$3) // handle, row, break level ($breakArrays)    C_LONGINT($1;$2;$3) // handle, row, break level ($breakArrays)
    C_LONGINT($dataArray) // position of the array to feed computed break in $dataArrays    C_LONGINT($dataArray) // position of the array to feed computed break in $dataArrays
-   // from the calling method (third parameter to PL_ProcessArrays)+    // from the calling method (third parameter to PL_ProcessArrays)
    C_TEXT($format;$breakText)    C_TEXT($format;$breakText)
    If ($3>=0) // is it a break    If ($3>=0) // is it a break
-   $dataArray:=6 // aSalary +    $dataArray:=6 // aSalary 
-   $format:="$###,###,###.00" +    $format:="$###,###,###.00" 
-   Case of +    Case of 
-   : ($3=1) // break on aCountry +     : ($3=1) // break on aCountry 
-   : ($3=2) // break on aState +     : ($3=2) // break on aState 
-   : ($3=3) // break on aCity +     : ($3=3) // break on aCity 
-   // $breakText:="Hello, I am the break at level "+String($3)+" after row "+String($2) \ +      // $breakText:="Hello, I am the break at level "+String($3)+" after row "+String($2) \ 
-   // +(Char(Carriage return)*2) // we could do this to use $2 +      // +(Char(Carriage return)*2) // we could do this to use $2 
-   // Concatenate the text for the current break +      // Concatenate the text for the current break 
-   $breakText:="" +      $breakText:="" 
-   $breakText:=$breakText+"There are "+String(PL_GetBreakValue ($1;$dataArray;5)) +" people in"\ +      $breakText:=$breakText+"There are "+String(PL_GetBreakValue ($1;$dataArray;5)) +" people in"\ 
-   +aCity{$2-1}+(Char(Carriage return)*2) +       +aCity{$2-1}+(Char(Carriage return)*2) 
-   $breakText:=$breakText+"Sum: "+String(PL_GetBreakValue ($1;$dataArray;1);$format)\ +      $breakText:=$breakText+"Sum: "+String(PL_GetBreakValue ($1;$dataArray;1);$format)\ 
-   +Char(Carriage return) +       +Char(Carriage return) 
-   $breakText:=$breakText+"Minimum: "+String(PL_GetBreakValue ($1;$dataArray;2);$format)\ +      $breakText:=$breakText+"Minimum: "+String(PL_GetBreakValue ($1;$dataArray;2);$format)\ 
-   +Char(Carriage return) +       +Char(Carriage return) 
-   $breakText:=$breakText+"Average: "+String(PL_GetBreakValue ($1;$dataArray;3);$format)\ +      $breakText:=$breakText+"Average: "+String(PL_GetBreakValue ($1;$dataArray;3);$format)\ 
-   +Char(Carriage return) +       +Char(Carriage return) 
-   $breakText:=$breakText+"Maximum: "+String(PL_GetBreakValue ($1;$dataArray;4); $format)\ +      $breakText:=$breakText+"Maximum: "+String(PL_GetBreakValue ($1;$dataArray;4); $format)\ 
-   +Char(Carriage return) +       +Char(Carriage return) 
-   $breakText:=$breakText+"Standard Dev: "+String(PL_GetBreakValue ($1;$dataArray;7);$format)\ +      $breakText:=$breakText+"Standard Dev: "+String(PL_GetBreakValue ($1;$dataArray;7);$format)\ 
-   +Char(Carriage return) +       +Char(Carriage return) 
-   // We perform the 5% calculation right here: +      // We perform the 5% calculation right here: 
-   $breakText:=$breakText+"Bonus:"+String(Round(PL_GetBreakValue ($1;$dataArray;3)*0,05;0);+      $breakText:=$breakText+"Bonus:"+String(Round(PL_GetBreakValue ($1;$dataArray;3)*0,05;0);
-   $format)+Char(Carriage return) +       $format)+Char(Carriage return) 
-   $breakText:=$breakText+"---------------"+Char(Carriage return) +      $breakText:=$breakText+"---------------"+Char(Carriage return) 
-   APPEND TO ARRAY(TbreakText_R;$breakText) +      APPEND TO ARRAY(TbreakText_R;$breakText) 
-   : ($3=4) // break on last name +     : ($3=4) // break on last name 
-   End case+    End case
    Else // this is a row because $3 < 0    Else // this is a row because $3 < 0
-   // do something+    // do something
    End if    End if
  
examples.txt · Last modified: 2017/06/27 14:09 by plp_admin