Tutorial 31 - Creating a Process to calculate Average Cost

In Tutorial 25 (Exercise 25-1), you configured a Procedure for the MERCH Template which is triggered on saving the record, provided the Amount > 0.00 AND GL == '120' i.e. when Inventory is increased. The purpose of the Procedure in Tutorial 25 is to Update the Invent table by setting the Recalculate switch to Yes (checked) every time a specific inventory Product Code is affected according to the specified Condition. After making such an Update the record in the Invent table looks like this:

Please Note:
The Average Cost is 0.00 and the Recalculate switch is set to Yes (checked) for all Product Codes since all inventory items were increased as part of the Opening Journal Entry (Tutorial 27).

In this Tutorial, you will configure a Process Procedure that will calculate the Average Cost for each Product Code that has the Recalculate switch set to Yes (checked) and after the Average Cost has been calculated, set the Recalculate switch to No (unchecked).


Exercise 31 -1, Configuring a Process Procedure

1. Launch the Process Procedures editor.


2. Configure the Process Procedure shown above with these Inspector settings for Retrievals and Updates (numbered 1 - 3)
1. Retrieval: Multiple rows (all)
Search: Recalculate = Yes
Sort: Product Code ASC
2. Retrieval: Single row
Search: GL = 120
Subledger = Invent.[Product Code]
Subledger Master = Stock
3. Update
Search: Product Code = Invent.[Product Code]

3. Save giving the Name AverageCost.

Exercise 31 - 2, Test the Process
The Process Procedure can and should be tested; however, no actual Update will take place or can be seen in the Invent table when you are in the Test mode.

1. Launch the Run Process function.
2. Select the Process > Select... menu item.
This will display the Select Process panel.
3. Select the AverageCost Process which will display this panel. Press the Run button.

Please note: The Run off line feature is available only with the Client-Server version.

4. Launch the General Data Entry function.
5. Select Invent from the Open Table panel.
6. Click on the Find button to display the Find records panel and press the Do button:

All four Product Codes have their Average Cost calculated and the Recalculate switches are all sitting at No.

Please Note:
In real life, this type of a Process will be run on a scheduled basis using the Schedule option which is enabled with all Client-Server Licenses.

The Frequency options are Monthly, Weekly, Daily, Hourly, Minutely:
Monthly can be run on a specified day and time or on the last day at a specified time.
Weekly can be run on a specified weekday (Sunday - Saturday) at a specified time.
Daily at a specified time.
Hourly at a specified minutes within the hour.
Minutely with a specified number of minutes interval.

Exercise 31 - 3, Modify the Invent Template and add data
Do not carry out this Exercise if you have a Deployment License and you were able to carry out the instructions of Exercise 31 - 2.

1. Launch the Global Templates editor and select Invent from the Open Global Data Template panel.
2. Select the Average Cost field and change the Input action from Lock to Ask.
3. Connect the Selling Price field to the Average Cost field, and Save.

4. Launch the General Data Entry function and select Invent from the Open Table panel.
5. Enter the Average Cost which is shown for each of the four Inventory items in Exercise 31 - 2 above.

Go To
  Tutorial 32 - Working with the Detail Object