|
|
Applies to versions: 1.5, 1.6, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 3.0, 3.1, 3.2
Advanced Formatting for Custom Payroll
TimeIPS custom payroll export supports advanced formatting.
The format area consists of the following sections:
- Arbitrary text - This can be anything you want to appear in the column. It is not related to the data. This is useful for adding a leading $, a code like A or B, or a description like Units or Pay before or after the actual data.
- A percent (%) - This tells the advanced formatting that you will be outputting data from the report. Following the %, there are several optional characters that can be put in order to produce the advanced formatting you need:
- Another % will show an actual "%" in the output
- An optional padding character that will be used, if needed, to make the output the right length. Standard padding characters are a space (default if nothing is specified) or a 0. For other padding characters, use a single quote (') in front of the character, i.e. '#.
- An optional alignment specifier that makes the output either left-justified or right-justified. The default is right justified. Put a - character to make it left justified.
- An optional width specifier - For example "2" can be listed next. This will make the length of the output at least this long.
- An optional precision specifier to indicate how many decimal places should be displayed for numbers, or the maximum characters for strings. For example, ".2" will add a decimal point and two digits.
- A data type specifier - For example "f" for numbers with decimals, "d" for numbers without decimal, "s" for text strings or "D" for numbers with implied decimals
- Note: In some fields, two pieces of data are available and can be accessed with %1s and %2s
Examples:
- To format 42.34236562 hours to have 4 digits after the decimal, use advanced formatting string such as "%1.4f"
- To format 25.05 as a pay amount to be "$25.05", use an advanced formatting string such as "$%2.2f"
- To format 5.00 as a pay amount to be "Pay: $005.00", use an advanced formatting string such as "Pay: $%03.2f"
- To format 5.00 with # padding to be "##5.00", use an advanced formatting string such as "$%'#3.2f"
- To format 8.33 units to simply be "Units: 8", use an advanced formatting string such as "Units: %d"
- To format .751 as a work percentage "75%", use an advanced formatting string such as "%2f%%"
- To format .751 as a work percentage "75.1%", use an advanced formatting string such as "%2.1f%%"
- To format 8.5 hours with leading zeros, 4 positions for the number and 4 implied decimal points "00085000", use an advanced formatting string such as "%04.4D"
Special characters can be specified, if needed to put reports on multiple lines, or to include tabs:
- A tab character can be specified with a \t
- A new line character can be specified with a \n
- A return character can be specified with a \r
Note: Some formatting options require Version 1.6.35 or later
For additional help, search the Internet for examples and help in using the "sprintf" function.
|