Keystroke Point of Sale Help


Reports and Labels - Filters and Formula Functions - Format

Syntax - @FORMAT(Expression, FormatString)

Parameters - Uses the built in Format$ function provided by Microsoft. See Microsoft's VBA documentation.

Expression - The value to be formatted.

FormatString - The mask used to determine the format.

Action - See Microsoft's VBA documentation for available masks.

Example - (@FORMAT([SYS:Report End Date], MM/DD/YY) - @FORMAT([SYS:Report Start Date], MM/DD/YY)+1

Result - The above example calculates the number of Days for which a report is run. If a start date of 01/01/18 and an end date of 01/31/18 are entered, the value returned is 31. Running the same report (with the same variable) for February, 2018, returns 28. This report variable example could be used in another formula to calculate the Average Qty Sold per Day or the Average $ Sold per Day based on the report dates entered.

Note: Serialized dates may be used with this function. However, 31047 must be added to any date generated by Keystroke since Keystroke bases its dates on 12/31/1984 while Microsoft uses 01/01/1900. (Both Microsoft and Keystroke use fractions of the day so this function can be used directly with Keystroke times).

Other Date Examples (using July 7th, 2017 at 2:15pm):

@FORMAT([SYS:Current Date], yyyymmdd\-hhnnss) returns the string: 20170709-141525
@FORMAT([SYS:Current Date], MM\/YYYY) returns: 07/2017

Note: Notice that a backslash (\) is used before operator symbols like \ or -. If not used, the function would try to divide or subtract the numbers used. The backslash is used to tell Keystroke Filters/Formulas to use the literal character and not the operator.

Other Number Examples (using Total Quantity Sold):

@FORMAT([ISAC:Total Qty], 00.00) for a quantity of 5.2 returns: 05.20

@FORMAT([ISAC:Total Qty], ##.##) for a quantity of 5.2 returns: 5.2

See:

Filters and Formula Functions - All

Filters and Formula Operators

Filters - Transaction Types

Keystroke Help Table Of Contents