Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Sage HRMS Reference Material Guide © 2011 Sage Software, Inc. All rights reserved. Sage, the Sage logos, and the Sage product and service names mentioned herein are registered trademarks or trademarks of Sage Software, Inc., or its affiliated entities. Business Objects, the Business Objects logo, and Crystal Reports are registered trademarks of SAP France in the United States and in other countries. NetLib is a registered trademark of Communication Horizons. OrgPlus is a trademark of HumanConcepts, LLC. TextBridge is a registered trademark of ScanSoft, Inc. Microsoft, Outlook, Windows, Windows NT, Windows Server, the .NET logo, Windows Vista and the Windows logo are trademarks or registered trademarks of Microsoft Corporation in the United States and /or other countries. The names of all other products and services are the property of their respective holders. Sage has made every effort to ensure this documentation is correct and accurate but reserves the right to make changes without notice at its sole discretion. Use, duplication, modification, or transfer of the product described in this publication, except as expressly permitted by the Sage License Agreement is strictly prohibited. Individuals who make any unauthorized use of this product may be subject to civil and criminal penalties. For additional assistance on this and other Sage products and services, visit our Web site at: http://www.sageabra.com Table of Contents Database Terms .................................................................................................. 1 Database File ........................................................................................................................... 1 Database Field ........................................................................................................................ 1 Field Type ....................................................................................................................................... 1 Field Name ..................................................................................................................................... 2 Field Length ................................................................................................................................... 2 Expressions and Functions ................................................................................................... 2 Database Structure ........................................................................................................................ 3 Data Dictionary.............................................................................................................................. 3 Data Dictionary Overview ........................................................................................................... 4 Database Structures ...................................................................................................................... 4 Sage HRMS Attendance Database File List ............................................................................... 5 Sage HRMS Database File List..................................................................................................... 5 Sage Train Database File List ....................................................................................................... 6 Expressions .......................................................................................................... 9 Field.......................................................................................................................................... 9 Relationship ............................................................................................................................ 9 Value ...................................................................................................................................... 10 Build Compound Expressions ........................................................................................... 10 Rules for Using Field Names in an Expression or Function ...................................................10 Use the Expression Builder ................................................................................................. 11 To Build an Expression ................................................................................................................12 Functions............................................................................................................ 15 Functions by Category ........................................................................................................ 15 Miscellaneous Functions .............................................................................................................17 Alphabetical List of Functions ....................................................................................................17 Reference Material i ii Sage HRMS Database Terms Before using the features of Sage HRMS, it is helpful to review some basic database concepts and terms. Database File A database file is a series of records. If you are familiar with electronic spreadsheet software, think of a record as a row in the spreadsheet. Each row contains data about one specific employee in the database. In an employee database file, each record contains data relating to one employee. A simple employee database file looks like the following table: L_NAME F_NAME SSN ID_NUMBER Birkin Stanley 129-61-7090 101 McTimm Jake 222-12-0148 102 Thornton John 322-73-8961 103 Signor Gina 444-78-2334 104 Kokai Thomas 552-45-6456 105 There are as many records in the database file as there are employees. The database has a file name and file extension. The master database file in the system, HRPERSNL, contains basic information about an employee's identification, Social Security number and address. Database Field Each record in the database has one or more fields. Think of a field as one column in the spreadsheet. Each field contains one item of data relating to the record. Field Type A field in a record is categorized by its field type. A numeric field contains only numbers (0 through 9). A character field contains letters of the alphabet, numbers, or special characters such as commas or dashes. The databases in Sage HRMS have fields with the following field types: • Numeric • Character • Date • Memo • Logical Reference Material 1 Expressions and Functions Field Name Every field in the record has a name for identification purposes. Usually the field name is an abbreviation describing the data in the field. The field name for the employee last name might be LNAME, L_NAME or LAST_NAME. For example, in the Sage HRMS system, the last name field name is P_LNAME. Field Length Another characteristic of a field is its length. A field for a Social Security number might be nine characters in length, or 11 if the hyphens in the number are part of the data. The field length for the employee last name is 25 characters, the length of the longest last name you are most likely to encounter. The length of a numeric field establishes the largest number that can be stored in that field and includes both the total length of the field and the number of positions to the right of the decimal point. Expressions and Functions Expressions and Functions are tools to manipulate data. An expression is similar to a mathematical formula; it is a statement of comparison between numbers or other data. Certain tasks within Sage HRMS require you to create an expression to help identify the records you want included in an action or process. For instance, when using the Mass Update process in Abra HR, you might want to search for all employees whose original hire date is before January 1, 2010. The expression builder, a feature which is a part of the process itself, helps you create the following expression: P_ORIGHIRE < {01/01/2010} The expression consists of three parts: a field, a relationship and a value. In this case the field is P_ORIGHIRE, the relationship is "less than" and the value is {01/01/2010}. A function is a quick way to change how data is represented in the system. For example, the value of the field L_NAME might be "Nelson." But if you want this name to appear with all capital letters, the function "UPPER(L_NAME)" does this for you. The value corresponding to UPPER(L_NAME) is "NELSON." 2 Sage HRMS Expressions and Functions Database Structure The database structure is a list identifying the name, type and length of each field in the database. In a complex database, the structure might also include a short description for each field to explain the purpose and use of the field. The database structure for the sample employee database used here is illustrated by the following table. Field Name Type Length L_NAME C 25 F_NAME C 14 SSN C 11 ID_NUMBER N 3,0 The L_NAME and F_NAME fields are both character fields. The SSN field is a character field rather than a numeric field since it also includes the dashes in the number. The ID_NUMBER field is three positions, meaning the largest number we can store in the field is 999. The zero means the ID_NUMBER does not contain any numbers to the right of the decimal point. Data Dictionary A data dictionary is a documentation tool which lists all the database files and their structure. You will find it useful if you use expressions and functions or if you use Crystal Reports. To obtain the most updated version of the data dictionary, you can run the Data Dictionary reports. 1. From the menu, select Reports > System > Data Dictionary Reports. The Data Dictionary Reports dialog box opens. 2. To print a list of database files, select Files List. To print a list of all the fields within each database file, select Fields List. To print a list of the Index Keys, select Index Keys List. 3. Select the appropriate check boxes for the products you want to appear on the report. 4. Click Preview to preview the report. When you are finished previewing, click the Close button to close the preview window. 5. Click Print to print the report. 6. Click the Close button to close the Data Dictionary Reports dialog box. Reference Material 3 Expressions and Functions Print Data Dictionary To obtain the most recent version of the database structure, run the Data Dictionary reports. To view or print the Data Dictionary: 1. From the Navigation Pane, select Reports > Data Dictionary Reports. The Data Dictionary Reports dialog box opens. 2. To print a list of database files, select the Files List radio button. To print a list of all the fields within each database file, select Fields List. To print a list of the Index Keys, select Index Keys List. 3. Select the products you want to appear on the report by selecting the appropriate check boxes. 4. Click Preview to preview the report. When you are finished previewing, click the Close button to close the preview window. 5. Click Print to print the report. 6. Click the Close button to close the Data Dictionary Reports dialog box. Data Dictionary Overview The Data Dictionary documents the database structure for all the database files used by Sage HRMS. You might find this information useful when building expressions within Sage HRMS or creating custom reports using Crystal Reports. It is also useful for programmers writing supplemental applications that share Sage HRMS data. If you want to access your data externally to the Sage HRMS software, you should have a thorough knowledge of database concepts and the database software you intend to use. Note: Time Off databases work with the databases included with Sage HRMS. Database Structures Before you access a database file, you might want to have the file layout (the database structure) available. The field type codes are as follows: • C Character • N Numeric • T Date/Time • L Logical 4 Sage HRMS Expressions and Functions • M Memo • I Integer • G General Note The Descriptions that accompany the fields in the data dictionaries are shown in Crystal Reports when you select fields to include in your custom reports. To obtain the most recent version of the database structure, run the Data Dictionary reports. Sage HRMS Attendance Database File List The following table lists the file name, description and alias for each database file. The files are listed alphabetically by file name. File Description Alias HATCO Previous Year Employee Attendance Summary CO HATOLD Previous Year Attendance Transactions AO HATPLAN Attendance Benefit Plan Definition PL HATSUM Employee Attendance Summary TO HATTRAN Employee Attendance Transaction AT Sage HRMS Database File List The following table lists the file name, description and alias for each database file. The files are listed alphabetically by file name. File Description Alias BPSPCDET Check Detail for ESS BPD BPSPCMAS Check Master for ESS BPM BPSW4 W4 Data for ESS BPW4 DDFIELD Data Dictionary Fields FLD DDFILE Data Dictionary File Names FIL DDINDEX Data Dictionary Index Keys IND GENEMAIL Update Employee E-mail Addresses GE HBEDEF Benefit Rate Setup DF HBENBEN Beneficiary Enrollments BB HBENE Employee Benefit BE HBEPLAN Benefit Plan Table BT HBERES Benefit Rate RS HDEPBEN Dependent Benefits DB HDEPEND Employee Dependent DE HEDU Employee Education History ED HEMERG Employee Emergency Contact EM HEVENTS Employee Event EV Reference Material 5 Expressions and Functions File Description Alias HJOBHIS Employee Job History JH HOSHA Employee OSHA OS HPREV Employee Previous Employment PV HREMPATT Employee Attachments EA HRENOTES Employee Notes EN HRLOA Leave of Absence LO HRMAS90 MAS 90 Payroll Setup MAS90 HRPERSNL Employee Personnel PE HRPHOTO Employee Photo PIC HRSECJOB Employee Secondary Job SJ HRTABLES HR and Payroll Code Table TA HSKILLS Employee Skill SK HTERMJH Terminated Employee Job TERMJH HTERMPE Terminated Employee Personnel TERMPE HWELL Employee Wellness WE OEBEPLAN Benefit Plan Table for Open Enrollment OEBT OEBEDEF Benefit Rate Setup for Open Enrollment OEDF OEBERES Benefit Rate for Open Enrollment OERS SYAUDIT Audit Trail AU SYBACKUP Backup Transaction Log BKP SYCRIT Criteria Table CT SYEMPLOY Employer Setup ER SYENTER Enterprise Setup ENT SYFILTER Product Group Filters FILTERS SYSCHED Schedule SCHEDULE SYSFIELD Security Group Field Access FLDSEC SYSRPT Security Report Writer Field Access RWSEC SYSTEP Security Steps STEPS SYTASK Security Task TASKS SYUSER Security User USERS Sage Train Database File List The following table lists the file name, description and alias for each database file. The files are listed alphabetically by file name. 6 File Description DDFIELD Data Dictionary Fields FLD DDFILE Data Dictionary File Names FIL DDINDEX Data Dictionary Index Keys IND HRPERSNL Employee Personnel PE HRTABLES HR and Payroll Code Tables TA Sage HRMS Alias Expressions and Functions File Description Alias NCATCOUR Course Catalog NCC NCATINST Instructor Catalog NIN NCATLOCA Training Location Catalog NLO NCATPROG Training Program Catalog NPR NCLAINFO Class Information NCI NCLALETT Class Correspondence Letters NLT NEMPCERT Employee Certifications NEC NEMPHIST Courses Taken NEH NEMPINFO Employee Miscellaneous Training Information NEI NEMPLOY Training Employer Setup NTS NEMPPROG Employee Training Programs NEP NEMPREQU Required Courses NER NJOBREQU Job Requirements NJR NPREREQU Course Prerequisites NCQ NPROCURR Training Program Curriculum NPC NSKILLS Associated Skills NSK SYAUDIT Audit Trail AU SYBACKUP Backup Transaction Log BKP SYEMPLOY Employer Setup ER SYENTER Enterprise Setup ENT SYFILTER Product Group Filters FILTERS SYSFIELD Security Group Field Access FLDSEC SYSRPT Security Report Writer Field Access RWSEC SYSCHED Schedule SCHEDULE SYSTEP Security Steps STEPS SYTASK Security Task TASKS SYUSER Security User USERS Reference Material 7 Expressions and Functions 8 Sage HRMS Expressions In some cases, an expression is merely an item of data presented in a different format. For instance, the last name field of an employee might be "Nelson." That same last name expressed in all capital letters would be "NELSON." But as it is most commonly used, an expression is similar to a mathematical formula; it is a statement of comparison among numbers or other data. For instance, when you perform a Mass Update process, you might want to include all employees with an original hire date prior to June 1, 2007. Communicating this in words, you might say, "I want to include all employees who were hired prior to June 1, 2007." For Sage HRMS, you must communicate this as an expression. The Expression Builder (also called the Criteria Builder) helps you create the following expression: PE.P_ORIGHIRE < {06/01/2007} In most cases, the expression you build will be a comparison between a database field and a value. The expression therefore, consists of three parts: Field The field identifies the database and the field to be used for the comparison. In the preceding example, "PE." tells the system to look in the HRPERSNL database file (because PE is the "alias" for the HRPERSNL database file - also called the Employee Personnel file). And "P_ORIGHIRE" (the Original Hire Date) is the name of the field. Relationship The relationship part of the expression defines how the field is compared to the value. The relationship between the two can be one of the following: • Exactly equal to • Equal to the same type • Less than • Less than or equal to • Greater than • Greater than or equal to • Not equal to In the example above, the less than symbol (<) tells the system that you want the field (Original Hire Date) to be less than the value (6/1/2011). Reference Material 9 Value Value The value is the part of the expression that the field is compared to. The data type of the value must match the data type of the field. For example, if the field is a date field, you must enter a date for your value. In other words, you could not enter 999, since you can’t compare a date to a number. Here’s another example. If the field in the expression is last name, you cannot enter a date as your value since a date doesn’t match the data type of a last name. So, in the example above, since the Original Hire Date (P_ORIGHIRE) is a date data type, the data type of the value matches because it is a date. Build Compound Expressions You can also build an expression that consists of more than one comparison. This is referred to as a compound expression. Suppose you want to search for all active employees who were hired before June 1, 2008. Here we need to create two comparisons: the first one tells the system to find employees who have an (A)ctive status; the second comparison tells the system that of those active employees, it should find only those who were hired before 6/01/2008. Using the Expression Builder, you would build the following compound expression: PE.P_ORIGHIRE<{06/01/2008} AND PE.P_ACTIVE="A" The two expressions are divided with the word "AND" telling the system to find the employees who satisfy both comparisons. If you used the word "OR" to divide the two expressions, Sage HRMS would find two sets of employees: those who were hired before 6/01/2008 and those who have an Active status. This would result in a much higher number of employees than if you used the "AND" function. Rules for Using Field Names in an Expression or Function 10 1. All field names must be spelled correctly. See the Data Dictionary for correct spellings. 2. Alphanumeric (character) data must be surrounded by quotes. 3. Dates must be enclosed in braces, i.e. {06/01/2011}. 4. If you are building a compound expression (when you need more than one condition to be met), the conditions must be separated by the word AND or by the word OR. You should use parentheses in complex conditional expressions. Sage HRMS Use the Expression Builder 5. 6. Use the following comparison operators: = Does a compare between two values of the same type. The = operator performs a comparison between two values of the same type. This operator is suited for comparing character, numeric, date, and logical data. However, when you compare character expressions with the = operator, the results might not be exactly what you expect. Character expressions are compared character for character from left to right until one of the expressions isn’t equal to the other, or until the end of the expression on the right side of the = operator is reached. Example: ="GA" will find both GA and GAUI == Does an exact comparison of character data. When two character expressions are compared with the == operator, the expressions on both sides of the == operator must contain exactly the same characters, including blanks, to be considered equal. =="GA" will find GA, but not GAUI > Greater than >= Greater than or equal to < Less than <= Less than or equal to <> Not equal to Capitalization is important. For example,"SALESREP" is not equal to "SalesRep". To avoid capitalization problems, use the UPPERfunction to make comparisons. The following example tells the system to convert the job code to upper case before making the comparison. UPPER(PE.P_JOBCODE)="SALESREP" Use the Expression Builder The expression must be formatted correctly so Sage HRMS can understand it. You can always type the expression in manually if you know exactly what the field, relationship, and value should be. Or you can use the Expression Builder to help you build the expression. As you work with Sage HRMS, whenever you see the Expression Builder button, click it to open the Expression Builder dialog box. Then create your expression. Note: If you are using a SQL Server database, some functions that are available in the Expression Builder may not work because they are specific to Visual FoxPro and there is not an equivalent function for SQL Server. See the list of valid functions that are supported for both databases. Reference Material 11 Use the Expression Builder All date fields contain the time in addition to the date. If you use dates in calculations you should remove the time part of the date using the Foxpro TtoD() function. For example: INT((Date() - TtoD(hrpersnl.p_birth))/365) TtoD(hrpersnl.p_lasthire) + 90 You may also want to remove the time from the date when displaying or printing dates. To Build an Expression This section will take you through building an expression. Here is the example: The sample company, Z Systems, Inc., is implementing a new policy. All active employees in the Sales/Marketing division will no longer have their performance review on their anniversaries. They will now all be reviewed on October 1. You’ll use the Mass Update process to change the next performance review date for these employees. First, select the database file and field to update. 1. From the Navigation Pane, select mass update for the group with which you want to work, for example Time Off > Mass Update. 2. Select Employee Personnel from the Update File list. 3. Select Next Performance Review Due Date from the Update Field list. You now need to tell Sage HRMS which employee records you want to update: click the Expression Builder button below the Records to Update field. The Expression Builder dialog box opens so you can build your expression. Refer to the Data Dictionary, for database file aliases. 1. In the From table list, notice that Pe is selected. Pe is the alias for the Employee Personnel database file. The file is already selected because you chose it as your Update File. 2. The Fields list contains all the fields contained in the Employee Personnel database file. Double-click P_ACTIVE, the second field in the list. The field, preceded by the "Pe" alias, appears in the Expression field. 3. In the Logical list, locate the equal sign (=) and click it. 4. Click your mouse button to place your cursor at the end of the expression and enter a space, single quote,A, single quote, space. Your expression should now look like this: You have just built the first comparison to tell Sage HRMS to look for all employees with an active employee status. 12 Sage HRMS Use the Expression Builder 5. In the Logical list, locate the word AND and click it. This starts your second comparison. 6. In the Fields list, locate the field P_LEVEL1 and double-click it. 7. In the Logical list, locate the equal sign (=) and click it. 8. Click your mouse button to place your cursor at the end of the expression and enter a space, single quote, SALES/MKTG, single quote. Your expression should now look like this: You have finished building the expression. Sage HRMS will find all active employees who work in the Sales/Mktg division (in ZSI, P_LEVEL1 has already been defined as the division). 9. Click OK to save your expression and return to the Mass Update dialog box. Tip: You can use the Verify button to make sure you’ve used the correct structure for your expression. For example, if you have an equal sign, it will confirm that you have a value after the equal sign. When you save your expression and return to the report or process for which you’re building the expression, Sage HRMS will check your expression again. If you have built an illogical expression, a message will indicate what is wrong. Return to the Expression Builder and fix your error. 10. Finish up your Mass Update process by typing October 1, 2008 in the New Value field. (Remember, this is the new date on which all employees will be reviewed.) 11. Click OK to complete the process and update the records. Reference Material 13 Use the Expression Builder 14 Sage HRMS Functions A function provides a quick way to perform an operation on data maintained by Sage HRMS. In most cases, you can use menus, text fields, lists, check boxes, and radio buttons to enter and manipulate data. But as described in the preceding section, Expressions, sometimes you need to build your own expression to define the processing you want to perform. And in some of these cases, you might need to use a function as part of the value in an expression. For example, the value of a last name field (P_LNAME) might be "Nelson." Instead, you want the name to appear in upper case (NELSON). You can use the UPPER function to accomplish this. Enter: UPPER(P_LNAME)="NELSON" A function consists of a function name and, in most cases, one or more parameters that are used by the function. These parameters are always placed in parentheses following the function name. Each parameter is separated by a comma. The format of a function then, is as follows: DESC(parameter1, parameter2, ...) The following section identifies some of the common functions and shows examples of their usage. For more information on functions, use online Help (by pressing F1) when you work with the Expression Builder. Functions by Category Date Functions CDOW() Gives you the name of the day of the week for a certain date. CMONTH() Gives you the name of the month for a certain date. DATE() Gives you the system date of the computer. DAY() Gives you the day of the month, expressed as a number. MONTH() Gives you the month of the year expressed as a number. YEAR() Gives you the year expressed as a number. Conversion Functions CTOD() Converts a date from character-type to date-type. DTOC() Converts date-data to character data in the form MM/DD/YY. DTOS() Converts date data to character data in the form YYYYMMDD. TRANSFORM() Converts any type of data into formatted character data. VAL() Converts character data into numeric data. Reference Material 15 Functions by Category Numeric Functions MAX() Finds the maximum of two numbers or dates. MIN() Finds the minimum of two numbers or dates. Formatting Functions INT() Truncates a number to its integer; for example, to the whole number. LOWER() Changes all the characters to lowercase. LTRIM() Removes the left-most spaces from the field. SPACE() Adds a specified number of spaces to the end of a field. TRIM() Removes trailing spaces from the field. UPPER() Changes all the characters to uppercase. Sage HRMS Functions AGE() Calculates the employee's age. AN1000() Calculates the annual salary of an employee up to the next 1,000. ANNPAY() Calculates annual salary as a whole number. ANNUAL() Calculates annual salary to two decimal places. COUNTDEP() Counts all dependents or those covered by a benefit plan. DEPENDAGE() Calculates the dependent's age. DEPENDSMOKER() Use to determine if the dependent is a smoker. If you use this function in an expression in a benefit plan rate table, set the expression as: iif(dependsmoker()'Y','N') and set the columns as Y and N. MONTHLY() Calculates the employee's salary on a monthly basis. YEARSOLD() Calculates the employee's age as a whole number. YEARSSENIORITY() Calculates the employee’s number of years with the company. Note: Sage HRMS functions are unique to the Sage HRMS system. They are not accessible from within the Expression Builder. To use a Sage HRMS function, you must manually enter it into your expression. 16 Sage HRMS Functions by Category Miscellaneous Functions EMPTY() Use on fields, other than date fields, to determine whether or not the field contains any data. IIF() Responds differently if different conditions are true. ISNULL() Use to evaluate whether a date field is empty. Use the expression: IIF((Isnull(hbene.b_expdate) or hbene.b_expdate > Date()), " X"," ") SUBSTR() Extracts a specific portion of a field. Alphabetical List of Functions Note: All date fields contain the time in addition to the date. If you use dates in calculations you should remove the time part of the date using the TtoD() function. For example: INT((Date() - TtoD(hrpersnl.p_birth))/365) TtoD(hrpersnl.p_lasthire) + 90 You may also want to remove the time from the date when displaying or printing dates. AGE() Description Parameters This function calculates the employee's age as a numeric field with two decimal positions. AGE(Date1,Date2) Usage and Examples Date1 is the date of birth; date2 is the basis for calculating the age. Neither parameter is required. AGE({01/01/1960}, {07/01/1995}) This would calculate the age as 35.5. AGE({01/01/1960}) This would calculate the age based on a birth date of 01/01/1960, and using the system date as the basis. AGE() This would calculate the age, using the date of birth in the employee master file and the system date. Reference Material 17 Functions by Category AN1000() Description Parameters Calculates the annual salary of an employee up to the next 1,000. AN1000() Usage and Examples No parameters are required. AN1000() An employee whose annual salary was 35,225 would be calculated with this function as 36,000. This might be useful if you want a management report showing relative salary levels, and do not want precise salary amounts. ANNPAY() Description Parameters Calculates the employee's annual salary as a whole number. ANNPAY() Usage and Examples No parameters are required. ANNPAY() This function calculates the annual salary based on other fields in the database. ANNUAL() Description Parameters Calculates the employee's annual salary to two decimal places ANNUAL() Usage and Examples No parameters are required. ANNUAL() This function calculates the annual salary based on other fields in the database. CDOW() Description Parameters Gives you the name of the day of the week. CDOW(Date) 18 Sage HRMS Usage and Examples Date must be datetype CDOW(DATE()) If the system date is July 2, 2008, this example will give you the name of the day, Wednesday. CDOW(DATE()-10) Gives you the current date and subtracts ten (10) days, giving you the name of the day. CDOW(P_ORIGHIRE) Gives the day of the week an employee was originally hired. Functions by Category CMONTH() Description Parameters Usage and Examples Gives you the name of the month for a certain date. CMONTH(Date) Date must be datetype. CMONTH(DATE()) If the system date is July 10,2008, this example will give you the name of the month, July. CMONTH(P_ORIGHIRE) = 'July' Gives you all employees whose original hire date is in July. COUNTDEP() Description Parameters You can use COUNTDEP() to count the number of dependents. COUNTDEP Usage and Examples (Char1,Char2) Char1 is the benefit plan code; Char2 specifies the type of dependent to count. Neither parameter is required. COUNTDEP() Counts all dependents. COUNTDEP("All') Counts all dependents. COUNTDEP ("Insured only") Counts the number of insured-only dependents. COUNTDEP("HMO 2007") Counts all dependents with the benefit plan code "HMO 2007." COUNTDEP ("HMO 2007,"CHILD") Counts the number of child dependents with the benefit plan code "HMO 2007." CTOD() Description Parameters Converts a date from charactertype to datetype. CTOD(Date) Usage and Examples Date must be character-type, in the format MM/DD/YY. CTOD() Use when you are entering a date in an expression and want to do date arithmetic, or if you have stored dates in character-type miscellaneous fields. CTOD('01/01/08') Takes the character-type date and converts it to 01/01/08 in date-type. CTOD('01/01/08')+180 Takes the character-type date, converts it to 01/01/08 in datetype, adds 180 days, and gives you 06/30/08 in date-type. Reference Material 19 Functions by Category DATE() Description Parameters Usage and Examples Gives you the system date of the computer. DATE() DATE() If today's date is July 10, 2007, this example will give you 07/10/07. DATE() + 180 If today's date is January 1, 2007, this example will give you 06/30/07. None are required. The system date should be today's date. If DATE() does not give you today's date, use Windows help for instructions on how to reset the date. You'll use this function frequently in performing date arithmetic. DAY() Description Parameters Gives you the day of the week, expressed as a number. DAY(Date) Usage and Examples Date must be datetype. DAY(DATE()) If the system date is July 10, 2007, this example will give you the exact day,10, in numeric-type. DEPENDAGE() Description Parameters This function calculates a dependent's age. DEPENDAGE(Date) Usage and Examples Date is the basis for calculating the age. No parameter is required. DEPENDAGE({07/01/2007}) This would calculate the dependent's age as of July 1, 2007. DEPENDAGE() This would calculate the age, using the date of birth in the employee master file and the system date. DEPENDSMOKER() Description Parameters Returns whether or not a dependent is a smoker. DEPENDSMOKER() 20 Sage HRMS Usage and Examples No parameters are required. DEPENDSMOKER() This returns Yes if the dependent is a smoker; No if the dependent is not. If you use this function in an expression in a benefit plan rate table, set the expression as: iif(dependsmoker()'Y','N') and set the columns as Y and N. Functions by Category DESC() Description Parameters Usage and Examples This function accesses code table descriptions. DESC(Char,Num) Char is the name of the data item for which you want a description. Num is the desired length of the description. Only the first parameter is required. Without Num, a length of 25 is assumed. If Num is zero, the function will remove any trailing spaces. DESC(P_LEVEL1) This would return the description corresponding to organization level 1. A length of 25 is assumed. DESC(P_LEVEL1,30) This would return the description corresponding to organization level 1. The description length would be 30. DTOC() Description Parameters Converts date-type data to character-type data in the form MM/DD/YY. DTOC(Date) Usage and Examples Date must be date-type. In order to change the original hire date field to character-type so that you can use it with character-type fields, use: P_LNAME + P_FNAME + DTOC(P_ORIGHIRE) Do not use DTOC() to sort by date because it sorts by month, day and year, which is not the logical chronological order: 03/01/61 03/05/62 04/01/58 05/31/50 Instead, use DTOS() as described below. DTOS() Description Parameters Converts date-type data to character-type data in the form YYYYMMDD. DTOS(Date) Usage and Examples Date must be datetype. DTOS(DATE()) If the system date is July 10, 2007, this example gives you 20070710 in character-type data. When you use DTOS() it sorts by year, month and day, which puts dates into logical chronological order (compare to DTOC() above): 05/01/50 (19500501) 04/01/58 (19580401) 03/01/61 (19610301) 03/05/62 (19620305) Reference Material 21 Functions by Category EMPTY() Description Parameters Usage and Examples Determines whether or not a field contains any data. EMPTY(Data) Data can be any type. EMPTY() This returns whether or not a field contains any data. IIF() Description Parameters Usage and Examples Allows the system to respond differently if different conditions are true. IIF(Cri,Exp1,Exp2) Cri is the criterion; if it is true, the result is the first element, Exp1. If Cri is false, the result is the second element, Exp2. The Parameters can be of any type. The expression IIF(P_Sex = M', Mr.', Ms.') says if the gender is male, use Mr'. If not male, use Ms'. INT() Description Parameters Truncates a number to its integer; i.e., to the whole number. INT(Num) Usage and Examples Num is the integer to be truncated. INT(10000.24) = 10,000 ISNULL() Description Parameters Usage and Examples Use to evaluate whether a date field is empty. NULL(Date) Date must be date-type. IIF((Isnull(hbene.b_expdate) or hbene.b_expdate > Date()), " X"," ") LOWER() Description Parameters Changes all the characters to lowercase. LOWER(Char) Usage and Examples Char is the field to be changed and must be character-type. LOWER() This is the opposite of UPPER(). See UPPER() for usage and examples. LTRIM() Description Parameters Removes the left-most spaces (the blank spaces in front of a character field) from the field. LTRIM(Char) 22 Sage HRMS Usage and Examples Char must be character-type. If you have created miscellaneous fields with leading spaces, this function will be useful in mass update to remove spaces. Functions by Category MAX() Description Parameters Usage and Examples Finds the maximum of two numbers or dates. MAX(Num1,Num2) Num1 and Num2 must both be numeric- or date-type. MAX(P_SALARY, 50000) Compares the salary to $50,000 and gives you whichever is greater. MIN() Description Parameters Usage and Examples Finds the minimum of two numbers or dates. MIN(Num1,Num2) Num1 and Num2 must both be numeric-type. The expression MIN(P_SALARY,50000) compares the salary to $50,000 and gives you whichever is less. MONTH() Description Parameters Usage and Examples Gives you the month of the year expressed as a number. MONTH(Date) Data must be datetype. To find all employees who were originally hired in the first month, or January, use MONTH(P_ORIGHIRE) = 1. MONTHLY() Description Parameters Calculates the employee's salary on a monthly basis. MONTHLY() Usage and Examples No parameters are required. MONTHLY() Since the employee's salary is not maintained as a single number, use MONTHLY() to calculate the employee's monthly salary. SPACE() Description Parameters Adds a specified number of spaces to a field so that it is a predetermined length. SPACE(Num) Usage and Examples Num is the specified number of spaces. SPACE() It is very useful to make sure all your columns are aligned correctly. If you TRIM() the spaces from fields and then add them together to form a new item, the results might not have the same lengths. This can cause your columns not to align correctly. For example: P_LNAME + SPACE(15) Employee's last name plus 15 spaces. Reference Material 23 Functions by Category STR() Description Parameters Converts numbers to characters. STR(Num,L,D) Usage and Examples Num is the number that you want to convert; L is the number of characters you want the result to have, and D is the number of decimals. L and D are optional. STR(P_SALARY,10,2) Gives you the salary with the result being ten characters long with two decimal places (for example, 9999999.99). Even though the result looks like a number, it is now character-type data. SUBSTR() Description Parameters Extracts a specific portion of a field. SUBSTR(Char,N1,N2) Usage and Examples Char is the name of the field from which you want to extract data and must be character-type. N1 is the position of the first character that you want to extract. N2 is the number of characters to be extracted and is an optional argument. If omitted, data is extracted from N1 to the end of the field. You might want to run a report on all employees who live in area code 813. To select the correct employees, you have to extract the area code from the phone number. To find those employees whose area code is 813, use the expression SUBSTR(P_HPHONE,2,3) = '813'. This example assumes that the area code is enclosed with parentheses: (813). The first position is the open parenthesis and the second position is the 8. TRIM() Description Parameters Removes all the trailing spaces (the blank spaces to the right of a field) from the field. TRIM(Char) 24 Sage HRMS Usage and Examples Char is the field you want to trim and must be charactertype. TRIM() Used when you join two character fields together and you want the columns in the report to be aligned. TRIM(P_LNAME + ', ' + TRIM(P_FNAME) gives you the last name, followed by a comma and a space, followed by the first name, with no extra spaces. The result will be JONES, FRED. Functions by Category UPPER() Description Parameters Changes all the characters in a field to uppercase letters. UPPER(Char) Usage and Examples Char is the field to be changed and must be character-type. UPPER() Useful when you are searching for exact matches because it eliminates problems resulting from differences in capitalization. To find all employees with the last name Adams or ADAMS, use UPPER(P_LNAME) = "ADAMS". Without using UPPER(), you would have only found employees named ADAMS whose last names were entered in all uppercase letters. VAL() Description Parameters Changes character-type data into numeric-type data. VAL(Char) Usage and Examples Char is the data to be changed and must be character-type. VAL() This is very useful when sorting. The computer sorts character-type numbers 1, 10, 11, 12, 2, 20, 21, etc. To sort numbers correctly, they must be numeric-type, in which case they will be sorted 1, 2, 10, 11, 12, 20, 21, etc. VAL(P_MISC2) If you have entered a number in the MISC2 field (which is a character-type field) and now want to be able to add up all the numbers for a range of employees, this example will convert the datatype to numeric-type so that the system can perform addition. YEAR() Description Parameters Gives you the year expressed as a number. YEAR(Date) Usage and Examples Date is the date, and must be date-type. YEAR(DATE()) If the system date is July 10, 2007, this example will give you 2007. To select employees whose date of original hire is 2007, use YEAR(P_ORIGHIRE) = 2007. Reference Material 25 Functions by Category YEARSOLD() Description Parameters This function calculates the employee's age as a whole number. The AGE() function calculates the age including two decimal places. You might want to use YEARSOLD() when you need to compute an employee's age for benefits calculations. YEARSOLD (Date1,Date2) Usage and Examples Date1 is the date of birth; Date2 is the basis for calculating the age. Neither parameter is required. YEARSOLD ({01/01/1967}, {07/01/2007}) This would calculate the age as 41. YEARSOLD ({01/01/1970}) This would calculate the age based on a birth date of 01/01/1970, using the system date as the basis. YEARSOLD() This would calculate the age, using the date of birth in the employee personnel file and the system date. YEARSSENIORITY() Description Parameters This function calculates active and LOA employees number of years with the company. You might want to use this function in a rate table for a savings plan whose employer match is based on an employee's number of years with the company. YEARSSENIORITY() 26 Sage HRMS Usage and Examples No parameters are required. YEARSSENIORITY() This calculates the years seniority, using the seniority date in the employee personnel file and the system date. If the employee is terminated, the function uses the termination date instead of the system date.