View
224
Download
0
Category
Preview:
Citation preview
Sage Abra SQL HRMS Reference Material User Guide
© 2010 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
Reference Material i
Table of Contents 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
Print the Sage Abra SQL HRMS Data Dictionary ......................................................... 4
Data Dictionary Overview............................................................................................ 5
Database Structures .............................................................................................................................................5
Abra Attendance Database File List ........................................................................... 6
Abra HR Database File List ........................................................................................... 6
Abra Train Database File List........................................................................................ 8
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...................................................................................................................... 13
Date Functions....................................................................................................................................................14 Conversion Functions........................................................................................................................................14 Numeric Functions ............................................................................................................................................14 Formatting Functions ........................................................................................................................................14 Sage Abra SQL HRMS Functions.....................................................................................................................15
ii Sage Abra SQL HRMS
Miscellaneous Functions................................................................................................................................... 15
Alphabetical List of Functions.................................................................................... 16
AGE()................................................................................................................................................................... 16 AN1000() ............................................................................................................................................................. 16 ANNPAY().......................................................................................................................................................... 17 ANNUAL() ......................................................................................................................................................... 17 CDOW() .............................................................................................................................................................. 17 CMONTH()......................................................................................................................................................... 17 COUNTDEP()..................................................................................................................................................... 18 CTOD() ................................................................................................................................................................ 18 DATE() ................................................................................................................................................................ 19 DAY()................................................................................................................................................................... 19 DEPENDAGE() .................................................................................................................................................. 19 DEPENDSMOKER().......................................................................................................................................... 19 DESC() ................................................................................................................................................................. 20 DTOC() ................................................................................................................................................................ 20 DTOS()................................................................................................................................................................. 21 EMPTY().............................................................................................................................................................. 21 IIF()....................................................................................................................................................................... 21 INT() .................................................................................................................................................................... 21 ISNULL()............................................................................................................................................................. 22 LOWER()............................................................................................................................................................. 22 LTRIM()............................................................................................................................................................... 22 MAX() .................................................................................................................................................................. 22 MIN() ................................................................................................................................................................... 22 MONTH()............................................................................................................................................................ 23 MONTHLY() ...................................................................................................................................................... 23 SPACE()............................................................................................................................................................... 23 STR() .................................................................................................................................................................... 23 SUBSTR()............................................................................................................................................................. 24 TRIM() ................................................................................................................................................................. 24 UPPER() .............................................................................................................................................................. 25 VAL() ................................................................................................................................................................... 25 YEAR()................................................................................................................................................................. 25 YEARSOLD() ...................................................................................................................................................... 26
Reference Material iii
YEARSSENIORITY() .........................................................................................................................................26
Sage University Overview .......................................................................................... 27
iv Sage Abra SQL HRMS
Reference Material 1
Database Terms Before using the features of Sage Abra SQL 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 Abra SQL HRMS have fields with the following field types:
• Numeric
• Character
• Date
• Memo
• Logical
Print the Sage Abra SQL HRMS Data Dictionary
2 Sage Abra SQL HRMS
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 Abra SQL 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 Abra SQL 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, 2008. The expression builder, a feature which is a part of the process itself, helps you create the following expression:
P_ORIGHIRE < {01/01/2008}
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/2008}.
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.ʺ
Print the Sage Abra SQL HRMS Data Dictionary
Reference Material 3
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 long; 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.
Print the Sage Abra SQL HRMS Data Dictionary
4 Sage Abra SQL HRMS
Print the Sage Abra SQL HRMS Data Dictionary To obtain the most recent version of the database structure, run the Data Dictionary reports.
To view or print the Sage Abra SQL HRMS Data Dictionary:
1. Log in to the Enterprise.
2. From the Navigation Pane, select, Reports > Data Dictionary Reports. The Data Dictionary Reports dialog box opens.
3. 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.
4. Select the products you want to appear on the report by selecting the appropriate check boxes.
5. Click Preview to preview the report. When you are finished previewing, click the Close button to close the preview window.
6. Click Print to print the report.
7. Click the Close button to close the Data Dictionary Reports dialog box.
Data Dictionary Overview
Reference Material 5
Data Dictionary Overview The Data Dictionary documents the database structure for all the database files used by Sage Abra. You might find this information useful when building expressions within Sage Abra SQL HRMS. However, it is provided here primarily as a convenience for computer programmers who are writing supplemental applications that share Sage Abra SQL HRMS data. If you want to access your data externally to the Sage Abra SQL HRMS software, you should have a thorough knowledge of database concepts, Xbase commands, and the database software you intend to use.
The database files have a ʺ.DBFʺ extension; their corresponding index files have a ʺ.CDXʺ extension.
Note: Abra Attendance databases work with the databases included with Abra HR.
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
• M Memo
• I Integer
• G General Note
To obtain the most recent version of the database structure, run the Data Dictionary reports.
Warning: We strongly recommend you never make any changes directly to the production version of any Sage Abra SQL HRMS file. Your data might be irreparably damaged if you alter Sage Abra SQL HRMS data with other software. Even if all you want to do is view (read from) an Sage Abra SQL HRMS file, you should first make a copy of it and do all your work using this copy. This is especially true if you are using Sage Abra SQL HRMS on a network.
Abra Attendance Database File List
6 Sage Abra SQL HRMS
Abra 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
Abra HR 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 AWC BPD BPSPCMAS Check Master for AWC BPM BPSW4 W4 Data for AWC 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 HJOBHIS Employee Job History JH HOSHA Employee OSHA OS HPREV Employee Previous Employment PV
Abra HR Database File List
Reference Material 7
File Description Alias
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
Abra Train Database File List
8 Sage Abra SQL HRMS
Abra 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.
File Description Alias
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 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
Expressions
Reference Material 9
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 Abra, 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 you want the field (Original Hire Date) to be less than the value (6/1/2007).
Build Compound Expressions
10 Sage Abra SQL HRMS
Value
The value is the part of the expression to which that the field is compared. 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 cannot compare a date to a number.
Here is another example. If the field in the expression is last name, you cannot enter a date as your value since a date does not 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 Abra SQL 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
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/2008}.
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.
Use the Expression Builder
Reference Material 11
5. 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
6. Capitalization is important. For example, ʺSALESREPʺ is not equal to ʺSalesRepʺ. To avoid capitalization problems, use the UPPER function 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 Abra SQL 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 Abra, 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.
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:
Use the Expression Builder
12 Sage Abra SQL HRMS
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 will 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 that you want to work with, 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 Abra SQL 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 Abra SQL HRMS to look for all employees with an active employee status.
Functions
Reference Material 13
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 Abra SQL 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 have 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 are building the expression, Sage Abra SQL 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 the 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.
Functions A function provides a quick way to perform an operation on data maintained by Sage Abra SQL 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:
Functions
14 Sage Abra SQL HRMS
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.
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.
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.
Functions
Reference Material 15
Sage Abra SQL 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 Abra SQL HRMS functions are unique to the Sage Abra SQL HRMS system. They are not accessible from within the Expression Builder. To use a Sage Abra SQL HRMS function, you must manually enter it into your expression.
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
16 Sage Abra SQL HRMS
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 Usage and Examples
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.
This function calculates the employeeʹs age as a numeric field with two decimal positions.
AGE(Date1,Date2) Date1 is the date of birth; date2 is the basis for calculating the age. Neither parameter is required.
AGE() This would calculate the age, using the date of birth in the employee master file and the system date.
AN1000()
Description Parameters Usage and Examples
Calculates the annual salary of an employee up to the next 1,000.
AN1000() 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.
Alphabetical List of Functions
Reference Material 17
ANNPAY()
Description Parameters Usage and Examples
Calculates the employeeʹs annual salary as a whole number.
ANNPAY() No parameters are required.
ANNPAY() This function calculates the annual salary based on other fields in the database.
ANNUAL()
Description Parameters Usage and Examples
Calculates the employeeʹs annual salary to two decimal places
ANNUAL() No parameters are required.
ANNUAL() This function calculates the annual salary based on other fields in the database.
CDOW()
Description Parameters Usage and Examples
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.
Gives you the name of the day of the week.
CDOW(Date) Date must be date‐type
CDOW(P_ORIGHIRE) Gives the day of the week an employee was originally hired.
CMONTH()
Description Parameters Usage and Examples
CMONTH(DATE()) If the system date is July 10,2008, this example will give you the name of the month, July.
Gives you the name of the month for a certain date.
CMONTH(Date) Date must be date‐type.
CMONTH(P_ORIGHIRE) = ʹJulyʹ
Gives you all employees whose original hire date is in July.
Alphabetical List of Functions
18 Sage Abra SQL HRMS
COUNTDEP()
Description Parameters Usage and Examples
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.ʺ
You can use COUNTDEP() to count the number of dependents.
COUNTDEP (Char1,Char2)
Char1 is the benefit plan code; Char2 specifies the type of dependent to count. Neither parameter is required.
COUNTDEP (ʺHMO 2007,ʺCHILDʺ)
Counts the number of child dependents with the benefit plan code ʺHMO 2007.ʺ
CTOD()
Description Parameters Usage and Examples
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.
Converts a date from character‐type to date‐type.
CTOD(Date) Date must be character‐type, in the format MM/DD/YY.
CTOD(ʹ01/01/08ʹ)+180 Takes the character‐type date, converts it to 01/01/08 in date‐type, adds 180 days, and gives you 06/30/08 in date‐type.
Alphabetical List of Functions
Reference Material 19
DATE()
Description Parameters Usage and Examples
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.
Gives you the system date of the computer.
DATE() 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 Usage and Examples
Gives you the day of the week, expressed as a number.
DAY(Date) Date must be date‐type.
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 Usage and Examples
DEPENDAGE({07/01/2007}) This would calculate the dependentʹs age as of July 1, 2007.
This function calculates a dependentʹs age.
DEPENDAGE(Date) Date is the basis for calculating the age. No parameter is required. DEPENDAGE() This would calculate the
age, using the date of birth in the employee master file and the system date.
DEPENDSMOKER()
Description Parameters Usage and Examples
Returns whether or not a dependent is a smoker.
DEPENDSMOKER() 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.
Alphabetical List of Functions
20 Sage Abra SQL HRMS
DESC()
Description Parameters Usage and Examples
DESC(P_LEVEL1) This would return the description corresponding to organization level 1. A length of 25 is assumed.
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,30) This would return the description corresponding to organization level 1. The description length would be 30.
DTOC()
Description Parameters Usage and Examples
Converts date‐type data to character‐type data in the form MM/DD/YY.
DTOC(Date) 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.
Alphabetical List of Functions
Reference Material 21
DTOS()
Description Parameters Usage and Examples
DTOS(DATE()) If the system date is July 10, 2007, this example gives you 20070710 in character‐type data.
Converts date‐type data to character‐type data in the form YYYYMMDD.
DTOS(Date) Date must be date‐type. 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)
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 Usage and Examples
Truncates a number to its integer; i.e., to the whole number.
INT(Num) Num is the integer to be truncated.
INT(10000.24) = 10,000
Alphabetical List of Functions
22 Sage Abra SQL HRMS
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 Usage and Examples
Changes all the characters to lowercase.
LOWER(Char) 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 Usage and Examples
Removes the left‐most spaces (the blank spaces in front of a character field) from the field.
LTRIM(Char) 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.
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.
Alphabetical List of Functions
Reference Material 23
MONTH()
Description Parameters Usage and Examples
Gives you the month of the year expressed as a number.
MONTH(Date) Data must be date‐type.
To find all employees who were originally hired in the first month, or January, use MONTH(P_ORIGHIRE) = 1.
MONTHLY()
Description Parameters Usage and Examples
Calculates the employeeʹs salary on a monthly basis.
MONTHLY() 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 Usage and Examples
Adds a specified number of spaces to a field so that it is a predetermined length.
SPACE(Num) 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.
STR()
Description Parameters Usage and Examples
Converts numbers to characters.
STR(Num,L,D) 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.
Alphabetical List of Functions
24 Sage Abra SQL HRMS
SUBSTR()
Description Parameters Usage and Examples
Extracts a specific portion of a field.
SUBSTR(Char,N1,N2) 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 Usage and Examples
Removes all the trailing spaces (the blank spaces to the right of a field) from the field.
TRIM(Char) Char is the field you want to trim and must be character‐type.
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.
Alphabetical List of Functions
Reference Material 25
UPPER()
Description Parameters Usage and Examples
Changes all the characters in a field to uppercase letters.
UPPER(Char) 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 Usage and Examples
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.
Changes character‐type data into numeric‐type data.
VAL(Char) Char is the data to be changed and must be character‐type.
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 data‐type to numeric‐type so that the system can perform addition.
YEAR()
Description Parameters Usage and Examples
Gives you the year expressed as a number.
YEAR(Date) 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.
Alphabetical List of Functions
26 Sage Abra SQL HRMS
YEARSOLD()
Description Parameters Usage and Examples
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.
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)
Date1 is the date of birth; Date2 is the basis for calculating the age. Neither parameter is required.
YEARSOLD() This would calculate the age, using the date of birth in the employee personnel file and the system date.
YEARSSENIORITY()
Description Parameters Usage and Examples
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() 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.
Sage University Overview
Reference Material 27
Sage University Overview The Sage University link connects you to the Sage Training homepage where you can get valuable training information and options.
Access Sage University from the Quick Launch Toolbar.
28 Sage Abra SQL HRMS
Reference Material 29
Index C
compound expressions, 10
D
data dictionary
database structures, 5
field type codes, 5
file layout, 5
overview, 5
database file list, 6, 8
database structures, 5
database terms
data dictionary, 3
database field, 1
database file, 1
database structure, 3
expressions and functions, 2
field length, 2
field name, 1, 2
field type, 1
E
Expression Builder, 11
an example, 11
building the condition: comparison: value, 10
selection criteria, 11
using, 11
Expressions
an example of, 10
building compound expressions, 10
Expression Builder, 11
parts of, 9
rules for using field names, 10
using, 9
F
functions, 13
Abra functions, 15
categories of, 13
conversion functions, 14
date functions, 14
formatting functions, 14
list of, 16
numeric functions, 14
P
parts of an expression, 9
processes
selection criteria for, 11
S
selecting records to include in a process, 11
Recommended