| FAQ 37: Grid--creating a formula to be displayed in a grid |
We are trying to make a saved grid that will have one column that adds both the current period Hours field and the Prior Hours field together so that year-end census information can be checked more efficiently.
Can you give us an example of how to do this?
You would need to create a formula file and then reference a formula within that file within your grid. To create a formula file, you would do the following:
- From the EMPLOYEE menu, choose View-Wizards-Formulas.
- Leave the "CreateNew" option on and click on the magnifying glass to choose a directory and a file name for the new file (the default directory is the \ASC\USER directory).
- Then click on the "Edit" button and change the Name, formula definition (in the big box on the right) and the Grid Properties. You could use a name like "TOTHOURS", and the formula definition would be the following:
The column Heading in the grid could be something like "PY Hours", the justification should be set to "Right", the Type should be set to "NUM", and the Format should be set to "0-9999".
Click on the "Execute" button to have the system evaluate your formula, to make sure that the syntax is correct. The formula should return a whole number. If it doesn't, the syntax of the formula is wrong and needs to be corrected. When finished, click on the "Post Edit" button.
- When finished creating formulas, click on the "OK" button to save the file.
Then when you want to insert the result of your formula into the grid, click on the "Formulas" button (and select the formula file to use, if prompted), choose your formula on the left, and click on the "Select Item" button. That's all that there is to it. The formula itself will not be saved within the grid, though, so you will have to choose the formula file in the future when you open this grid since it references a formula.