![]() | Programming Guide | ![]() |
Executes a math expression
int sm_calc(int field_number, int occurrence, char *expression);
field_number- The field to use for relative field references, for backward compatibility only. If
expressionreferences fields according to current conventions, supply 0.occurrence- The occurrence in
field_numberto use for relative field references, for backward compatibility only. Ifexpressionreferences fields according to current conventions, supply 0.expression- A math expression. Refer to "Performing Calculations and Validating Numbers" in Using the Editors for information on creating math expressions.
- 0 Success
sm_calclets you execute a math expression. Use this function to perform mathematical operations that use the contents of one or more fields and then insert the result into a field.If, in the event of a math error, you want the cursor to move a specific field, specify that field with
field_number. If the field is an array andoccurrenceis offscreen, Panther scrolls that occurrence into view.
/* Compute payment due date. */
sm_calc(0, 0, "paymentduedate = @date(shipdate) + 30");
![]()
![]()
![]()
![]()