240
edits
Changes
From All n One's bxp software Wixi
Created page with "== Overview == The bxp looping engine allows a creator of a Key Stats report to ensure that the report he/she creates is 100% dynamic i.e not limiting the report to a set nu..."
== Overview ==
The bxp looping engine allows a creator of a Key Stats report to ensure that the report he/she creates is 100% dynamic i.e not limiting the report to a set number of time intervals or to a set number of forms.
The looping engine of Key Stats should be used in conjunction with the numerous dynamic replacements that bxp key stats module provides or with the user specified custom replacements.
The looping engine greatly enhances the reporting ability of any Key Stats report by enabling the creation of 100% dynamic and customisable reports, that could meet any user needs. When creating the a Key Stats Report an using the looping engine, there are two loop types are your disposal: ''Outer Loop'' and ''Internal Loop'', you are able to have as many ''Outer Loops'' in the report as required and also have as many ''Internal Loops'' but every ''Internal Loop'' cannot have another ''Internal Loop'' inside it.
When adding loops to a Key Stat report, the loops can be added at two levels i.e ''Tab level'' and ''Graphic level''
In coding terms the looping engine of the bxp Key Stats module handles the same as the conventional ''FOR loop'' i.e Loop the following for X times.
== Creating an Outer Loop ==
When creating an Outer Loop in a bxp Key Stats report, there are three required pieces of syntax required:
1) [Loop_Start] -- This alerts the looping engine of Key Stats to the start of an Outer loop section in the report
2) [Loop_End] -- This alerts the looping engine of Key Stats to the end of an Outer loop section in the report
3) [##X##] -- This tells the looping engine of key Stats that the contents of the current Outer loop should be looped X times
=== Outer Loop Structure ===
<syntaxhighlight lang="html4strict">
[Loop_Start][##/* LoopCount */##]
// * Content to Loop and Copy
[Loop_End]
</syntaxhighlight>
=== Outer Loop In Use Example ===
Anything in between the Start and End Loop tags will be repeated the set number of times specified, the looped content can be anything: HTML, JavaScript, Key Stats, Internal Loops or even the entire Key Stats report.
<syntaxhighlight lang="html4strict">
<!--bxp Key Stats Tab Layout-->
<table id="objExampleTable">
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
[Loop_Start][##3##]
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
[Loop_End]
</table>
<!--bxp Key Stats Report Output-->
<table id="objExampleTable">
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
</table>
</syntaxhighlight>
== Creating an Internal Loop ==
When creating an Outer Loop in a bxp Key Stats report, there are three required pieces of syntax required:
1) [Internal_Loop_Start] -- This alerts the looping engine of Key Stats to the start of an Internal loop section in the report
2) [Internal_Loop_End] -- This alerts the looping engine of Key Stats to the end of an Internal loop section in the report
3) [##X##] -- This tells the looping engine of key Stats that the contents of the current Internal loop should be looped X times
'''* NOTE: ''' There should never be an Internal Loop Inside an Internal Loop, the looping engine of Key Stats will not allow an internal loop to have an internal loop
=== Internal Loop Structure ===
<syntaxhighlight lang="html4strict">
[Internal_Loop_Start][##/* LoopCount */##]
// * Content to Loop and Copy
[Internal_Loop_End]
</syntaxhighlight>
=== Internal Loop In Use Example ===
Anything in between the Start and End Loop tags will be repeated the set number of times specified, the looped content can be anything: HTML, JavaScript, Key Stats, Internal Loops or even the entire Key Stats report.
<syntaxhighlight lang="html4strict">
<!--bxp Key Stats Tab Layout-->
<table id="objExampleTable">
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
[Loop_Start][##3##]
[Internal_Loop_Start][##2##]
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
[Internal_Loop_End]
[Loop_End]
</table>
<!--bxp Key Stats Report Output-->
<table id="objExampleTable">
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
</table>
</syntaxhighlight>
== Key Stat Graphic Looping==
When creating a Graphic Key Stats your are able to perform the same looping options as above, but instead of adding the looping syntax to the Key Stat Tab, the syntax gets added to the actual KeyStat that is rendering the graphic. The same Key Stat syntax is used for both the Outer and Internal Loops.
<syntaxhighlight lang="html4strict">
<!--bxp Key Stats Outer Loop-->
[Loop_Start][##/* LoopCount */##]
// * Content to Loop and Copy
[Loop_End]
<!--bxp Key Stats Internal Loop-->
[Internal_Loop_Start][##/* LoopCount */##]
// * Content to Loop and Copy
[Internal_Loop_End]
</syntaxhighlight>
== Dynamic Replacements ==
The Key Stats looping engine of bxp allows for the user of dynamic replacements, these dynamic replacements allow for you to include the current count of the loop. The current loop count can be replaced as many times as required.
To perform this replacement the following key words should be used
1) [[LoopCount]] -- This gets replaced with the current loop count for Outer loops
2) [[Internal_LoopCount]] -- This gets replaced with the current loop count for Internal loops
=== Dynamic Replacements In Use ===
<syntaxhighlight lang="html4strict">
<!--bxp Key Stats Outer Loop-->
[Loop_Start][##3##]
Current Loop Count: [[LoopCount]]
[Loop_End]
<!--Output-->
Current Loop Count: 1
Current Loop Count: 2
Current Loop Count: 3
<!--bxp Key Stats Internal Loop-->
[Loop_Start][##3##]
[Internal_Loop_Start][##2##]
Current Loop Count: Outer:[[LoopCount]] || Internal: [[Internal_LoopCount]]
[Internal_Loop_End]
[Loop_End]
<!--Output-->
Current Loop Count: Outer: 1 || Internal: 1
Current Loop Count: Outer: 1 || Internal: 2
Current Loop Count: Outer: 2 || Internal: 1
Current Loop Count: Outer: 2 || Internal: 2
Current Loop Count: Outer: 3 || Internal: 1
Current Loop Count: Outer: 3 || Internal: 2
</syntaxhighlight>
=== Dynamic Parameter Replacements ===
When using the user set dynamic replacements ''keyStatsCustom'', you can modify the parameters inside an SQL statement, for example if you had the statement that counts the number of contacts (CCL's) that happen between two dates but by using the Looping engine th report is set up to
allow an indefinite amount of dates to be passed in. Instead of creating a different key stat for every iteration of the parameters, you can use the one key stats but replace the parameters that gets passed to it. To use the dynamic replacements for the parameters passed in you need to use the foollowing syntax (but make sure it is the very last parameter passed to the key stat:
<syntaxhighlight lang="html4strict">
// * Structure
[[intParamAdd:/*Start Position*/;/*Number to Add*/;/*Number to subtract*/]]
// * Examples
[[intParamAdd:1;2;0]] --> Will replace in the SQl statement as 3
[[intParamAdd:3;0;2]] --> Will replace in the SQl statement as 1
[[intParamAdd:[[LoopCount]];2;0]] --> Will replace in the SQl statement as the current Outer loop count +2
[[intParamAdd:[[Internal_LoopCount]];2;0]] --> Will replace in the SQl statement as the current Internal loop count +2
</syntaxhighlight>
As a Key Stat can have multiple parameter to replace we need to specify were in out statement to perform the replacement, to do this we need to add a specific key word to the places,
in the SQL statement that we want to replace. This key word is ''[[intParamAdd]]'', when the Key Stats engine sees this it will replace it with the required value, as outlined above.
<syntaxhighlight lang="MySQL">
// * Replacement Syntax -> [[intParamAdd:1;2;0]] --> Replace [[intParamAdd]] with 3
// * SQL Statement before replacement
SELECT COUNT(intCCL_292_Id) FROM CCL_292
WHERE dteCCL_292_EndDateTime >= '--parameter[[intParamAdd]]-- 00:00:00'
AND
dteCCL_292_EndDateTime <= '--parameter[[intParamAdd]]-- 00:00:00';
// * SQL Statement before replacement
SELECT COUNT(intCCL_292_Id) FROM CCL_292
WHERE dteCCL_292_EndDateTime >= '--parameter3-- 00:00:00'
AND
dteCCL_292_EndDateTime <= '--parameter3-- 00:00:00';
</syntaxhighlight>
After the replacement has been calculated we have a final option that can be used, this option allows a key stat to further add to the number generated by the above examples.
To use this functionality we modify the key word ''[[intParamAdd]]'' (outlined above), to be ''[[intParamAdd:X]]''. Replace X with the number you want to add to the dynamic parameter replacement already generated
<syntaxhighlight lang="MySQL">
// * Replacement Syntax -> [[intParamAdd:1;2;0]] --> Replace [[intParamAdd]] with 3
// * SQL Statement before replacement
SELECT COUNT(intCCL_292_Id) FROM CCL_292
WHERE dteCCL_292_EndDateTime >= '--parameter[[intParamAdd:0]]-- 00:00:00'
AND
dteCCL_292_EndDateTime <= '--parameter[[intParamAdd:1]]-- 00:00:00';
// * SQL Statement before replacement
SELECT COUNT(intCCL_292_Id) FROM CCL_292
WHERE dteCCL_292_EndDateTime >= '--parameter3-- 00:00:00'
AND
dteCCL_292_EndDateTime <= '--parameter4-- 00:00:00';
</syntaxhighlight>
The bxp looping engine allows a creator of a Key Stats report to ensure that the report he/she creates is 100% dynamic i.e not limiting the report to a set number of time intervals or to a set number of forms.
The looping engine of Key Stats should be used in conjunction with the numerous dynamic replacements that bxp key stats module provides or with the user specified custom replacements.
The looping engine greatly enhances the reporting ability of any Key Stats report by enabling the creation of 100% dynamic and customisable reports, that could meet any user needs. When creating the a Key Stats Report an using the looping engine, there are two loop types are your disposal: ''Outer Loop'' and ''Internal Loop'', you are able to have as many ''Outer Loops'' in the report as required and also have as many ''Internal Loops'' but every ''Internal Loop'' cannot have another ''Internal Loop'' inside it.
When adding loops to a Key Stat report, the loops can be added at two levels i.e ''Tab level'' and ''Graphic level''
In coding terms the looping engine of the bxp Key Stats module handles the same as the conventional ''FOR loop'' i.e Loop the following for X times.
== Creating an Outer Loop ==
When creating an Outer Loop in a bxp Key Stats report, there are three required pieces of syntax required:
1) [Loop_Start] -- This alerts the looping engine of Key Stats to the start of an Outer loop section in the report
2) [Loop_End] -- This alerts the looping engine of Key Stats to the end of an Outer loop section in the report
3) [##X##] -- This tells the looping engine of key Stats that the contents of the current Outer loop should be looped X times
=== Outer Loop Structure ===
<syntaxhighlight lang="html4strict">
[Loop_Start][##/* LoopCount */##]
// * Content to Loop and Copy
[Loop_End]
</syntaxhighlight>
=== Outer Loop In Use Example ===
Anything in between the Start and End Loop tags will be repeated the set number of times specified, the looped content can be anything: HTML, JavaScript, Key Stats, Internal Loops or even the entire Key Stats report.
<syntaxhighlight lang="html4strict">
<!--bxp Key Stats Tab Layout-->
<table id="objExampleTable">
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
[Loop_Start][##3##]
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
[Loop_End]
</table>
<!--bxp Key Stats Report Output-->
<table id="objExampleTable">
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
</table>
</syntaxhighlight>
== Creating an Internal Loop ==
When creating an Outer Loop in a bxp Key Stats report, there are three required pieces of syntax required:
1) [Internal_Loop_Start] -- This alerts the looping engine of Key Stats to the start of an Internal loop section in the report
2) [Internal_Loop_End] -- This alerts the looping engine of Key Stats to the end of an Internal loop section in the report
3) [##X##] -- This tells the looping engine of key Stats that the contents of the current Internal loop should be looped X times
'''* NOTE: ''' There should never be an Internal Loop Inside an Internal Loop, the looping engine of Key Stats will not allow an internal loop to have an internal loop
=== Internal Loop Structure ===
<syntaxhighlight lang="html4strict">
[Internal_Loop_Start][##/* LoopCount */##]
// * Content to Loop and Copy
[Internal_Loop_End]
</syntaxhighlight>
=== Internal Loop In Use Example ===
Anything in between the Start and End Loop tags will be repeated the set number of times specified, the looped content can be anything: HTML, JavaScript, Key Stats, Internal Loops or even the entire Key Stats report.
<syntaxhighlight lang="html4strict">
<!--bxp Key Stats Tab Layout-->
<table id="objExampleTable">
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
[Loop_Start][##3##]
[Internal_Loop_Start][##2##]
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
[Internal_Loop_End]
[Loop_End]
</table>
<!--bxp Key Stats Report Output-->
<table id="objExampleTable">
<tr>
<td>Heading 1</td>
<td>Heading 2</td>
<td>Heading 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
<tr>
<td>Content 1</td>
<td>Content 2</td>
<td>Content 3</td>
</tr>
</table>
</syntaxhighlight>
== Key Stat Graphic Looping==
When creating a Graphic Key Stats your are able to perform the same looping options as above, but instead of adding the looping syntax to the Key Stat Tab, the syntax gets added to the actual KeyStat that is rendering the graphic. The same Key Stat syntax is used for both the Outer and Internal Loops.
<syntaxhighlight lang="html4strict">
<!--bxp Key Stats Outer Loop-->
[Loop_Start][##/* LoopCount */##]
// * Content to Loop and Copy
[Loop_End]
<!--bxp Key Stats Internal Loop-->
[Internal_Loop_Start][##/* LoopCount */##]
// * Content to Loop and Copy
[Internal_Loop_End]
</syntaxhighlight>
== Dynamic Replacements ==
The Key Stats looping engine of bxp allows for the user of dynamic replacements, these dynamic replacements allow for you to include the current count of the loop. The current loop count can be replaced as many times as required.
To perform this replacement the following key words should be used
1) [[LoopCount]] -- This gets replaced with the current loop count for Outer loops
2) [[Internal_LoopCount]] -- This gets replaced with the current loop count for Internal loops
=== Dynamic Replacements In Use ===
<syntaxhighlight lang="html4strict">
<!--bxp Key Stats Outer Loop-->
[Loop_Start][##3##]
Current Loop Count: [[LoopCount]]
[Loop_End]
<!--Output-->
Current Loop Count: 1
Current Loop Count: 2
Current Loop Count: 3
<!--bxp Key Stats Internal Loop-->
[Loop_Start][##3##]
[Internal_Loop_Start][##2##]
Current Loop Count: Outer:[[LoopCount]] || Internal: [[Internal_LoopCount]]
[Internal_Loop_End]
[Loop_End]
<!--Output-->
Current Loop Count: Outer: 1 || Internal: 1
Current Loop Count: Outer: 1 || Internal: 2
Current Loop Count: Outer: 2 || Internal: 1
Current Loop Count: Outer: 2 || Internal: 2
Current Loop Count: Outer: 3 || Internal: 1
Current Loop Count: Outer: 3 || Internal: 2
</syntaxhighlight>
=== Dynamic Parameter Replacements ===
When using the user set dynamic replacements ''keyStatsCustom'', you can modify the parameters inside an SQL statement, for example if you had the statement that counts the number of contacts (CCL's) that happen between two dates but by using the Looping engine th report is set up to
allow an indefinite amount of dates to be passed in. Instead of creating a different key stat for every iteration of the parameters, you can use the one key stats but replace the parameters that gets passed to it. To use the dynamic replacements for the parameters passed in you need to use the foollowing syntax (but make sure it is the very last parameter passed to the key stat:
<syntaxhighlight lang="html4strict">
// * Structure
[[intParamAdd:/*Start Position*/;/*Number to Add*/;/*Number to subtract*/]]
// * Examples
[[intParamAdd:1;2;0]] --> Will replace in the SQl statement as 3
[[intParamAdd:3;0;2]] --> Will replace in the SQl statement as 1
[[intParamAdd:[[LoopCount]];2;0]] --> Will replace in the SQl statement as the current Outer loop count +2
[[intParamAdd:[[Internal_LoopCount]];2;0]] --> Will replace in the SQl statement as the current Internal loop count +2
</syntaxhighlight>
As a Key Stat can have multiple parameter to replace we need to specify were in out statement to perform the replacement, to do this we need to add a specific key word to the places,
in the SQL statement that we want to replace. This key word is ''[[intParamAdd]]'', when the Key Stats engine sees this it will replace it with the required value, as outlined above.
<syntaxhighlight lang="MySQL">
// * Replacement Syntax -> [[intParamAdd:1;2;0]] --> Replace [[intParamAdd]] with 3
// * SQL Statement before replacement
SELECT COUNT(intCCL_292_Id) FROM CCL_292
WHERE dteCCL_292_EndDateTime >= '--parameter[[intParamAdd]]-- 00:00:00'
AND
dteCCL_292_EndDateTime <= '--parameter[[intParamAdd]]-- 00:00:00';
// * SQL Statement before replacement
SELECT COUNT(intCCL_292_Id) FROM CCL_292
WHERE dteCCL_292_EndDateTime >= '--parameter3-- 00:00:00'
AND
dteCCL_292_EndDateTime <= '--parameter3-- 00:00:00';
</syntaxhighlight>
After the replacement has been calculated we have a final option that can be used, this option allows a key stat to further add to the number generated by the above examples.
To use this functionality we modify the key word ''[[intParamAdd]]'' (outlined above), to be ''[[intParamAdd:X]]''. Replace X with the number you want to add to the dynamic parameter replacement already generated
<syntaxhighlight lang="MySQL">
// * Replacement Syntax -> [[intParamAdd:1;2;0]] --> Replace [[intParamAdd]] with 3
// * SQL Statement before replacement
SELECT COUNT(intCCL_292_Id) FROM CCL_292
WHERE dteCCL_292_EndDateTime >= '--parameter[[intParamAdd:0]]-- 00:00:00'
AND
dteCCL_292_EndDateTime <= '--parameter[[intParamAdd:1]]-- 00:00:00';
// * SQL Statement before replacement
SELECT COUNT(intCCL_292_Id) FROM CCL_292
WHERE dteCCL_292_EndDateTime >= '--parameter3-- 00:00:00'
AND
dteCCL_292_EndDateTime <= '--parameter4-- 00:00:00';
</syntaxhighlight>