|Search the WinSPC Knowledgebase
||Browse by Category
|How do I use the Expression Calculator component in the Report Designer (RAVE)?
The Expression Calculator component can be used to perform calculations on one or more data fields from a DataView. This report designer component is not a visible component (meaning it will not show up in the designer, but will show up in the object tree on the right side of the report template designer).
11th of October, 2010
Thank you for rating this answer.
For example, you might want to calculate the difference between the USL and LSL of a list of variables. The Expression Calculator component will help you do this. The report might look something like this:
To create this report:
The report template can now be saved and previewed against any folder, part, variable or dataset. It will display each variable's name and the difference between the variable's configured USL and LSL values. You might add other useful information (such as column headings or other data columns) to the report. You can also download an exported version of this report below. To learn how to import this report template, visit this knowledgebase article.
- Create a new Report Template (choose the 'Banded Portrait' master template).
- Edit the report template and launch the report designer by clicking on the 'Run Report Designer' button.
- Select the 'ReportDataBand' in the design window and set the following properties:
- DataView : Variable_ (since this is where the specification information is located).
- Add a 'DataText' component (from the 'Report' tab) to the 'ReportDataBand' (for aesthetics purposes to display the variable name), and set the following properties:
- DataView : Variable_
- DataField : Name
- Create a new parameter to hold the result of the calculation. To do this:
- Select one of the top level components in the 'Report Library' tree on the right side of the screen. For example, select the page ('Page1').
- On the left side of the screen, select the 'Parameters' property, and open up the editor dialog by clicking on the '...' button.
- Add the desired parameter name. In this case, enter the text 'MyCalcResult' (without the single quotes) and press 'Enter'.
- Click 'OK' to close the editor.
- Add an 'Expression Calculator' component (from the 'Reports' tab) to the 'ReportDataBand' (click on the 'Expression Calculator' button, then single click on the desired destination band). Set the following properties:
- DestPara : MyCalcResult
- Expression : (open up the editor by clicking on the '...' button and enter the following calculation:) Variable_.USLValue - Variable_.LSLValue
- Click 'OK' to close the editor.
- To display the result (stored in the parameter), we need to add another 'DataText' component. Add a 'DataText' component to the 'ReportDataBand' and set the following properties:
- DataField : (click on the '...' button, select 'MyCalcResult' from the 'Project Parameters' drop down, and click on the 'Insert Parameter' button. Click 'OK' to save the changes.
The Expression Calculator supports the standard mathematical operators (+, -, *, /), constants, and a variety of functions. For example, the following expression could be used:
Variable_.USLValue * 100 + Variable_.LSLValue - 1
The following functions, constants, and operators can be used in the Expression Calculator:
- Abs(x) : Absolute value of x (can also use |x| to get the same result)
- ACos(x) : ArcCosine of x
- ASin(x) : ArcSine of x
- ATan(x) : ArcTangent of x
- Cos(x) : Cosine of x
- Dec(x) : Decrement x by 1
- Exp(x) : Exponential of x (i.e., e raised to the power of x)
- Inc(x) : Increment x by 1
- Ln(x) : Natural log of x
- Log(x) : Log of x
- Sign(x) : returns -1 if x < 0, 0 if x = 0, and 1 if x > 0
- Sin(x) : Sine of x
- SqRt(x) : Square root of x
- Tan(x) : Tangent of x
- Pi : constant for Pi (i.e. 3.1415...)
- + : addition
- - : negation and subtraction
- * : multiplication
- / : division
- ^ : power (i.e., x^y = x raised to the y power)
Note: This sample report template does NOT take into account variables with uni-lateral specifications. It is simply an example to demonstrate the use of the 'Expression Calculator' component.
No visitor comments posted. Post a comment