0% found this document useful (0 votes)
78 views

Workforce Int MNGR v8 Advanced Int Prog (Practice)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views

Workforce Int MNGR v8 Advanced Int Prog (Practice)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Workforce Interface Manager™

Advanced Interface Programming

Practice Exercises

Revision A
P/N 4704876-001
The information in this document is subject to change without notice and should not be construed as a commitment by Kronos Incorporated.
Kronos Incorporated assumes no responsibility for any errors that may appear in this manual. This document is for the use of the intended
recipient, and it may not be reproduced in whole or in part or used for any other purpose than that for which it was provided without the prior
written permission of Kronos Incorporated. Copyright, Kronos Incorporated or a related company, 2015. All rights reserved.

Altitude, Cambridge Clock, CardSaver, Datakeeper, Datakeeper Central, eForce, Gatekeeper, Gatekeeper Central, Imagekeeper, Jobkeeper
Central, Keep.Trac, Kronos, Kronos Touch ID, Kronos InTouch, the Kronos logo, Kronos Workforce Ready, My Genies, PeoplePlanner,
PeoplePlanner & Design, Schedule Manager & Design, ShopTrac, ShopTrac Pro, StarComm, StarPort, StarSaver, StarTimer,Timekeeper,
Timekeeper Central, TimeMaker, Visionware, Workforce Accruals, Workforce Central, Workforce Decisions, Workforce Express, Workforce
Genie, and Workforce TeleTime are registered trademarks of Kronos Incorporated or a related company. Altitude Dream, Altitude Pairing,
Altitude PBS, Comm.Mgr, CommLink, DKC/Datalink, FasTrack, HR and Payroll Answerforce, HyperFind, Improving the Performance of
People and Business, Kronos 4500, Kronos 4500 Touch ID, Kronos e-Central, Kronos KnowledgePass, KronosWorks, KVC On Demand,
Labor Plus, Momentum, Momentum Essentials, Momentum Online, Schedule Assistant, Smart Scheduler, Smart View, StartLabor, Start
Quality, Start WIP, Starter Series, Timekeeper Decisions, Timekeeper Web, VisionPlus, Winstar Elite, WIP Plus, Workforce Activities,
Workforce Attendance, Workforce Collaboration, Workforce Connect, Workforce Employee, Workforce HR, Workforce Leave, Workforce
Manager, Workforce Mobile, Workforce MobileTime, Workforce Payroll, Workforce Record Manager, Workforce Recruiter, Workforce
Scheduler, Workforce Scheduler with Optimization, Workforce Smart Scheduler, Workforce Tax Filing, Workforce Timekeeper, Workforce
Analytics, Workforce Acquisition, Workforce View, Workforce Absence Manager, Workforce Device Manager, Workforce Integration Manager,
Workforce Forecast Manager, and Workforce Operations Planner, Workforce Task Management, and Workforce TeleTime IP are
trademarks of Kronos Incorporated or a related company.

IBM, eServer, and iSeries are trademarks of International Business Machines Corporation. StandardsPro® is a registered trademark of H.B.
Maynard and Company, Inc. Vortex and Vortex Mobile Scheduler Connect are trademarks of Vortex Connect. Citrix is a registered trademark
of Citrix. All other product and company names mentioned are for identification purposes only, and may be trademarks of their respective
owners.

When using and applying the information generated by Kronos products, customers should ensure that they comply with the applicable
requirements of federal and state law, such as the Fair Labor Standards Act. Nothing in this Guide shall be construed as an assurance or
guaranty that Kronos products comply with any such laws.

These training materials are provided for general educational purposes and are not intended to convey legal, accounting, or regulatory
compliance advice. Such advice can only be obtained through your own attorney, certified public accountant or other qualified professional,
with full knowledge of your organization's particular operations, circumstances and policies. Readers are encouraged to consult with
appropriate professional advisors concerning their individual circumstances before making decisions affecting their business operations. Last
updated March 18, 2015.

Kronos KnowledgePass™ subscription is designed to be your pre-training, post-training,


and refresher skills destination. Kronos KnowledgePass contains tutorials, learning
snippets, job aids, and much more to support the training you receive from Kronos-certified
instructors. Kronos KnowledgePass education support materials stream right to your
desktop and are all available 24/7
To find out if your organization subscribes to Kronos KnowledgePass, speak to the
individual responsible for the Kronos solution at your organization. If you are not a
subscriber and you are interested in Kronos KnowledgePass, please give us a call at
888 293 5549.

Published by Kronos Incorporated


297 Billerica Road, Chelmsford, Massachusetts 01824-4119
Phone: 978-250-9800, Fax: 978-367-5900
Kronos Incorporated Global Support: 1-800-394-HELP (1-800-394-4357)

Workforce Interface Manager


Advanced Interface Programming
Document Revision History

Document Revision Product Version Release Date


A Workforce Interface Manager June 2015
Practice Exercises

Practice Exercises

Module 1: Extracting and Manipulating Data

Lesson 1: Transferring data from the source

Let me: Extracting and concatenating data part 1


In this practice you will extract data from the source file and concatenate different
pieces of the data.
A. Study the function of offsets by reading the fixed length text file,
FixedASCII1.TXT. Each record is nine characters long. Create a link that
extracts the following data elements. The output should be comma
delimited. Solution: FixedASCII.KNX.

Data Description
Element
F1 The original 9 character string without using extra field parsing.
F2 The original 9 character string using extra field parsing to begin at offset
= 0 and length = 9.
The output from this field should be identical to F1. It is simply done a
different way.
F3 The first character of the field. Use extra field parsing to accomplish the
task.
F4 The second character of the field. Transfer only the first 5 characters
and extract the second character using extra field parsing.
F5 Transfer the first 9 characters of the field, but use extra field parsing to
begin at offset = 1 and length = 0.
F6 Transfer the first 5 characters of the field, but use extra field parsing to
begin at offset = 5 and length = 1.

1. What difference did you see between data element F1 and F2?
_______________________________________________
2. What does the length of 0 in data element F5 accomplish?
_______________________________________________

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-1


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

3. What was the output from data element F6?


_______________________________________________
B. Build a link that extracts the employee’s full name from the Workforce
Central database. Additionally create the username by concatenating
the first initial of the first name with the first seven letters of the last
name. If the total length is less than eight characters, there is no need to
make adjustments. The output should be comma delimited. The data
elements are described below. There is no need to use Special Name
Parsing in this practice, the name parts are stored in separate fields in
the database. Solution: TextManip2B.KNX.

Data Element Description


Emp Name Select Employee Name from the list. Enclose in quotes.
User Name Use a calculation to create the user name. Select First
name and Last name from the list

C. Extra challenge! If the username in practice “B” above is less than 8


characters, pad the remaining characters with the first initial of the first
name, repeated as often as necessary. For example, the username JDoe
would become JDoeJJJJ. Solution: TextManip2C.KNX.

Alternate solution
For the last practice above, You could use the string function Length to return the
length of the last name.
Use the function within a calculation to determine how many characters you need
to add to the string. You can then use the Add Character function to add the
appropriate number of characters.

Let me: Extracting and concatenating data


part 2
In this practice you will extract data from the source file and concatenate different
pieces of the data.
A. Add another data element to the Workforce Central extract that creates
an identifier for an employee. The identifier looks like 04LR9401 and is
composed of the following parts:

Two digit month of the date of hire


First initial of last name
First initial of first name
Two digit year of the date of hire
Two digit day of the date of hire

Hint: Use variables for each piece of data. Solution: TextManip3A.KNX.


“Adams, Julie”,JAdams,02AJ9808
“Snow, Fred”,FSnow,06SF8811
“Adams, Donald”,DAdams,01AD0413

1-2 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Extra challenge! Modify the link to create an identifier string composed


of the following parts:

Two digit month of the date of hire


First initial of last name
Last letter of the last name
First initial of first name
Two digit year of the date of hire
Two digit date of the date of hire

All letters should be upper case. Solution: TextManip3B.KNX.

Alternate solution
For the last practice above, You could use the string function Length to return the
length of the last name.
Use the function within a calculation to determine how many characters you need
to add to the string. You can then use the Add Character function to add the
appropriate number of characters.

Lesson 2: Building parsing calculations

Let me: Parsing data


In this practice you will build calculations to parse the source data and return
portions of it.
A. The file TextIn-1.TXT is a comma delimited single field text file. The
single field contains two pieces of information; the first occupies either
four or five positions and is separated from the second by a dash (-).
Create a link that reads the source and outputs the original data and the
first part of the information not including the dash. The output should be
comma delimited. The data elements of the output are described below.
Solution: TextManip1.KNX.

Data Element Description


Original Data The original data
Before the Dash The part of the data that occurs before the dash (-)

A sample of the output is shown below:


ABCD-1234,ABCD
EFGH-7890,EFGH
JKLMN-8989,JKLMN
PQRST-456,PQRST

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-3


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Modify the link to output the second part of the field as an additional
data element. Hint: Use variables for the individual pieces.
A sample of the output is shown below:
ABCD-1234,ABCD,1234
EFGH-7890,EFGH,7890
JKLMN-8989,JKLMN,8989
PQRST-456,PQRST,456
C. Modify the link to concatenate the two substrings by replacing the ‘-’
with a ‘/’. Sample output is shown below. Hint: Use variables for the
individual pieces.
ABCD-1234,ABCD,1234,ABCD/1234
EFGH-7890,EFGH,7890,EFGH/7890
D. Extra Challenge! Modify the link to trap for errors if the dash character is
not in position 5 or position 6. Test your modifications with the file
TextIn-1A.TXT as the source. Solution: TextManip1-A.KNX

Let me: Using pattern matching


In this practice you will use wild cards in a lookup table to return selected values
A. The file TextIn-2.TXT is a comma delimited text file. The first field
contains two pieces of information; the first occupies either five or six
positions and is separated from the second by an ampersand (&). The
second part of the data is either four or five characters long. Create a
link that reads the source and outputs the original data and the first and
second parts of the information not including the ampersand. The
output should be comma delimited. The data elements of the output are
described below. Solution: TextManip5.KNX.

Data Description
Element
Orig The original data
First The part of the original data that occurs before the ampersand (&)
Second The part of the original data that occurs after the ampersand (&)

A sample of the output is shown below:


XDCBA&1234,XDCBA,1234
ZNMLKJ&8989,ZNMLKJ,8989
ZTSRQP&45694,ZTSRQP,45694

1-4 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Let me: Using the search function


In this practice you will employ string functions to perform parsing of the source
file.
A. The file TextIn-3.TXT is a comma delimited text file output from a
manufacturing system. The first field contains two pieces of
information; the first is the work order number and may be from 4 to 16
characters long. It is separated from the part number by the caret
symbol (^). Create a link that reads the source and outputs the original
data and the first and second parts of the information not including the
caret. The output should be fixed length. The data elements of the
output are described below. Solution: TextManip6.KNX.

Data Description
Element
Orig The first field in the source file
Work order The part of the original data that occurs before the caret (^)
Part number The part of the original data that occurs after the caret (^)
Quantity The second field in the source file

A49531-01^Wid656 A49531-01 Wid656 100


A49531-02^Wid657 A49531-02 Wid657 10
B. Extra challenge! The file, markup_source.TXT, has XML-like tags that
identify the data. Each record contains four items of information.
Examine the source file and build a link that extracts the information
without the markup tag names. Solution: markup_source_solution.KNX.
52 07/26/09 10.00 Evening
52 07/26/09 30.00 Regular
135 07/26/09 4.00 Daily-OT
135 07/26/09 64.00 Regular
135 07/26/09 8.00 Sick
135 07/26/09 8.00 Vacation

Module 2: Working with Dates and Times

Lesson 1: Understanding valid dates

Note
Practices “A” and “B” are not typical source files because of the
varying date formats. Typical sources have consistent formats for any
given date field.

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-5


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Let me: Understanding dates


In this practice you will experiment with dates expressed in different formats to
determine which formats Workforce Integration Manager considers valid. You will
also extract date parts using variables.

A. Create a link to read the file dates.TXT. This is comma delimited file with
a single field containing dates in several formats. Some of the formats
are not valid so do not expect the results to be valid. Create a link that
reads the original date string and displays it in the manner shown in the
table. Do not use variables.
Solution: DateTest1.KNX.

Data Element Data Type Action


Original date Text Transfer from source
Date as c Date type, format is “c” Transfer from source
Date as number Numeric, 2 decimals Transfer from source
Date-Calc-Text Text Calculation; assign value
Date-Calc-as c Date type, format is “c” Calculation; assign value
Date-Calc-numeric Numeric, 2 decimals Calculation; assign value

1. Which combinations of data type and actions give invalid results for valid
dates?
_______________________________________________

1-6 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Create a link that reads the comma delimited text file, dates-In-2.TXT and
use variables to extract date pieces. This file contains 2 fields: the first
is a date string, the second is a description of the validity of the value of
the first item. Create a link that has the following output. Solution:
DateTest2.KNX.

Data Length Comments


Element
Original 12 The original contents of the first field formatted as text.
Date as c 12 The original contents of the first field formatted as
Date/Time, specifier of “c”. Action is Transfer from
source.
Validity 22 The value of the second field formatted as text.

1. Was the field Date as c formatted correctly? Did it check for invalid dates?
_______________________________________________
C. Create a link that reads the text file, dates-In-6.TXT and uses variables to
extract date pieces. This file contains only one field: a date string in
mm/dd/yyyy format. Create a link that has the following output.
Solution: DateTest3.KNX.

Data Length Comments


Element
Original 12 The original contents of the first field formatted as text.
Date as c 12 The original contents of the first field formatted as
Date/Time, specifier of “c”. Action is Transfer from
source.
Day 12 The value of the variable :Day formatted as text.
Month 12 The value of the variable :Month formatted as text.
Year 12 The value of the variable :Year formatted as text.

Create variables that extract the three parts of the date. All of them are
evaluated on a per record interval and are a Date/Time type.

Variable Comment
:Day Format as “dd”
:Month Format as “mm”
:Year Format as “yyyy”

1. Were correct values for Day, Month, and Year returned on the dates?
_______________________________________________
D. Add a variable for the day of the week and include it in your output.
Solution: DateTest3.KNX.
1. What values were returned on the dates?
_______________________________________________
E. Extra challenge! Add a field that indicates the number of the day of the
week. For example Sun = 1, Mon = 2, … Solution: DateTest3.KNX.

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-7


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Let me: Non-standard datesL


This practice provides the opportunity to interpret dates that use non-standard
formats.

A. Create a link that reads the comma delimited file Dates-In-3.TXT. The
file’s format is described in the header record. Create a fixed length
output consisting of the following fields.

Data Length Comments


Element
Name 22 Employee name
ID 5 Employee ID
Hire date Org 12 Hire date in the original format for comparison
Hire date 12 Hire date expressed in mm/dd/yyyy format

A sample of the output is shown below:


Adams, Julie 1 98.08.02 02/08/1998
Snow, Fred 10 88.11.06 06/11/1988
Stock, Donna 11 90.21.06 06/21/1990
Solution: DatesIn3.KNX.

Let me: 2-digit years


In this practice you will explore how Workforce Integration Manager interprets
2-digit years and determine the century divide.

A. How does Workforce Integration Manager interpret a 2 digit year as


being in the twentieth or twenty-first century? Use the input file
yearlist.TXT (comma delimited) as a source for answering the question
posed above. Create a link that reads in the file and displays the date
with a four digit year. The data elements are described below. Solution:
YearTestSolution.KNX.

Data Comments
Element
Original data The original contents of the first field formatted as text
Year only The original contents of the first field formatted as Date/Time,
specifier of “yyyy”. Action is Transfer from source.

1. In what year does Workforce Integration Manager change from


interpreting 2-digit years as being in the 20th century to interpreting them
as being in the 21st century?
_______________________________________________

1-8 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Let me: Changing the century divide


Now that you know where the century divide is set, you can program a link to
compensate for 2-digit years without relying on the application server regional
settings.

A. Create a calculation that changes the default to interpret any year less
than 50 to the 21st century. For example, 01/01/49 is interpreted as
01/01/2049. Add it to the link you just created that read the year. Use
yearlist.TXT as your source. A description of the data elements is
displayed below with a sample of output. Solution:
YearTestSolution.KNX.

Data Comments
Element
Original date The original contents of the first field formatted as text
Year only The original contents of the first field formatted as Date/Time,
specifier of “yyyy”. Action is Transfer from source.
Corrected Year The value of the corrected year formatted as text.

14 Jan 27,2027,2027
14 Jan 28,2028,2028
14 Jan 29,2029,2029
14 Jan 30,1930,2030
14 Jan 31,1931,2031
B. Extra challenge! Modify the link so that the division point (50) is
assigned by a variable with a preprocess execution interval and a static
text action.
Solution: YearTestSolution-A.KNX.
C. Extra Challenge! Modify the link so that the division point is input by the
user in response to a prompt.

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-9


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Lesson 2: Performing date math

Let me: Working with date calculations


In this practice you will create and debug different types of date calculations.

A. Create a calculation that subtracts the Hours worked date from the
current date and displays the difference. Use WFC for your source data.
For a greater variety of dates use the Daily Records option. The output
should be fixed length text. A description of the data elements is shown
below. Solution: DateMath4.KNX.

Data Length Comments


Element
Emp Name 25 Employee Name
Hours Worked 12 Hours Worked Date (Hours Wrkd Date) formatted
Date as mm/dd/yyyy
Current Date 12 Current date formatted as mm/dd/yyyy
Difference 4 Calculation showing the difference in the dates

Adams, Julie 09/14/2009 09/21/2009 0007


Adams, Julie 09/14/2009 09/21/2009 0007
Adams, Julie 09/14/2009 09/21/2009 0007
Adams, Julie 09/14/2009 09/21/2009 0007
Adams, Julie 09/14/2009 09/21/2009 0007
Adams, Julie 09/15/2009 09/21/2009 0006
Adams, Julie 09/15/2009 09/21/2009 0006
B. Create a new link that takes the employee’s hire date and add 90 days to
it to find when the probation period ends. Output one record per
employee. Use a WFC source. The output should be fixed length text. A
description of the data elements is shown below. Solution
DateMath5-A.KNX.

Data Length Comments


Element
Name 25 Employee Name
Hire Date 12 Hire date formatted as mm/dd/yyyy
Probation Ends 12 Calculated new date formatted as mm/dd/yyyy

Adams, Julie 02/08/1998 05/09/1998


Snow, Fred 06/11/1988 09/09/1988
Adams, Donald 01/13/2004 04/12/2004
Smith, Draco 02/29/2000 05/29/2000

1-10 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

C. Create a calculation that displays the number of days in an employee’s


pay period. Use the WFC source specified by the instructor. The output
should be fixed length text. A description of the data elements is shown
below. Solution: DateMath8.KNX.

Data Element Length Comments


Name 25 Employee Name
Pay period start 12 Pay period start date
Pay period end 12 Pay period end date
Length 4 Difference of start and end dates

Adams, Julie 04/14/2015 04/20/2015 7


Snow, Fred 04/14/2015 04/27/2015 14
Adams, Donald 04/14/2015 04/27/2015 14
D. Extra challenge! Do a “Save as” on DateMath1.KNX and modify the copy
to display last Friday’s date and next Friday’s date as well. Solution:
DateMath7.KNX.

Let me: Date calculations


In this practice you will create date math calculations for Julian dates and other
date formats.

A. Create a link that expresses the employee’s hire date in Julian format.
The link should include the employee’s name and hire date expressed in
both mm/dd/yyyy format and DDD/yyyy format. Use the Workforce
Central database supplied by the instructor. The output should be fixed
length. Solution: Julian2.KNX.

Data Length Comments


Element
Name 20 Employee Name
Hire date m-d-y 12 Hire date expressed in mm/dd/yyyy format
Hire date Julian 10 Hire date expressed in Julian format

Adams, Julie 02/08/1998 039/1998


Snow, Fred 06/11/1988 163/1988
Adams, Donald 01/13/2004 013/2004

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-11


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Create a link that reads the file JulianDatesIn.TXT and convert the dates
to mm/dd/yyyy format using the alternate solution of adding the days to
the end date of the previous year. The output is described below.
Solution: Julian1-A.KNX.

Data Length Comments


Element
Original Julian 12 The original data transferred from the source
New date 12 The date expressed in mm/dd/yyyy format
m-d-y

001/2001 01/01/2001
032/2001 02/01/2001
111/2001 04/21/2001
365/1949 12/31/1949
C. Determine if the year is a leap year. Use the table
LeapTableOut.tbl. Solution: Julian1-A.KNX.
D. Extra Challenge! Create a link that reads the file JulianDatesIn-Alt.TXT
and converts the dates to mm/dd/yyyy format. The dates in the source
file have a variable-length day format. Solution: Wildcard2.KNX.
1/2001 01/01/2001
32/2001 02/01/2001
111/2001 04/21/2001
E. Extra Challenge! Create a link that reads the comma delimited file
CenturyFormatIn.TXT. The file contains the employee name and the hire
date expressed as “101365”. The first character represents the century:
0 is 1900, 1 is 2000, etc. The next two digits represent the year within the
century. The last 3 digits represent the Julian day in the year. The link
should output the name and the hire date expressed as mm/dd/yyyy.
Solution: CenturySolution.KNX.

1-12 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Performing time math

Let me: Understanding time formats


In this practice you will explore the various time formats that Workforce Integration
Manager can interpret.

A. Create a link to read the comma delimited text file, Times-In-1214-B.TXT.


The file is single field, comma delimited, and contains times in various
formats. View the file before creating your link.
The fixed length output should consist of the original string formatted
as text, the original string formatted as date/time with an “hh:nn”
specifier, and the original string read into a variable called :Time where
the “hh:nn” specifier is applied. Solution: TimeTest1214-B.KNX.

Data Length Type Comments


Element
Original data 25 Text The original data from the source file
Time with 12 Date/Time The original data in hours and minutes
colon format with a colon separator
Time from 12 Text The original data read into a variable
variable where the hh:nn format is specified

B. Add variables to parse the hours and minutes individually from the
string. Add data elements to the output to display these fields. Solution:
TimeTest1214-B.KNX.

Data Length Type Comments


Element
Hours 12 Text Value of the variable containing the hours
Minutes 12 Text Value of the variable containing the minutes

1. Are there any invalid times? What are they?


_______________________________________________
2. What does Workforce Integration Manager do when it encounters an
invalid time?
_______________________________________________

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-13


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Lesson 3: Performing date and time math

Let me: Performing date/time math


In this practice you will create calculations for dates and times by adding a
duration to a start date and time.

A. Create a link that reads the start time and duration from the fixed length
text file DateTimeMath2.TXT. Examine the file to determine the location
of the various fields. The output is described below. Solution:
TimeMath6.KNX.

Data Length Description


Element
Start Date/Time 20 The original date/time from the file read as text.
Duration Org 5 The original duration, not formatted.
Stop Date/Time 22 The results of the calculation that adds the
duration to the start time.

01/01/2009 08:00 480 39814.66666666 01/01/2009


04:00:00 PM
02/01/2009 03:00 600 39845.54166667 02/01/2009
01:00:00 PM

1-14 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Extra Challenge! Create a link to read the fixed length text file
DateTimeMath3.TXT. The file layout is given below.

Starting Length Description


position
1 8 Date in mmddyyyy order, no separators
9 4 Time of day in 24-hour format (hhmm), no separators
13 4 Duration expressed in hours and minutes (hhmm)
with no separator

The output is fixed length text. All output fields are formatted as text.
The link should output the following fields. Solution:
DateTimeMath3.KNX.

Data Length Description


Element
Start Date Org 10 The original date not formatted
Start Time Org 6 The original time not formatted
Duration Org 6 The original duration, not formatted
Start Date Fmt 12 Start date formatted as mm/dd/yyyy, right justified
Start Time Fmt 6 Calculation that adds a colon to the original time
from the source file, right justified
Duration Fmt 6 Calculation that adds a colon to the original time
from the source file, right justified
End DTM 18 Calculation that adds the duration to the start
date and time, right justified

10272009 0800 0800 10/27/2009 08:00 8:00 10/27/2009


16:00
10272009 0300 1000 10/27/2009 03:00 10:00 10/27/2009
13:00

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-15


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Lesson 4: Calculating the Week Number

Let me: Calculating the week number


In this practice you will create a calculation that determines the week number for
any date.

A. Create a link that reads the single field comma delimited file
YearDates1.TXT and associates a week number with each date. At a
minimum, include the source date, the Julian day number and the week
number. Additional outputs of interim calculation values may be helpful
in debugging. Solution:WeekNum1.KNX. A sample of the minimum
output is shown below:
1/1/2009,001,1
1/2/2009,002,1
1/3/2009,003,1
1/4/2009,004,1
1/5/2009,005,1
1/6/2009,006,1
1/7/2009,007,1
1/8/2009,008,2
1/9/2009,009,2
B. Extra challenge! Use the source file WeekNumSource.TXT and create a
link that calculates the week number based on the assumptions that the
first week starts on the week that contains at least one day. Solution:
WeekNum2.KNX.
C. Extra challenge! Use the source file WeekNumSource.TXT and create a
link that calculates the week number based on the assumptions that the
first week starts on the week that contains at least four days. Solution:
WeekNum3.KNX.
D. Extra challenge! Use the source file WeekNumSource.TXT and create a
link that calculates the week number based on the assumptions that the
first week starts on the week that contains seven days. Weeks with
fewer than seven days are considered week 0.

1-16 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Module 3: Using SQL with Workforce


Integration Manager

Lesson 1: Using SQL in Workforce Integration Manager


Creating and dropping tables

Let me: Using SQL statements


In this practice you will use SQL statements to perform various functions with
databases. The plan is to read the data from the text source file into a temporary
database table. With the data in the temporary database table, you can use SQL
to extract the data in a more reasonable format. The source file has the following
format.

Field Description Data Type


1 Employee ID NVARCHAR
2 Last name NVARCHAR
3 First name NVARCHAR
4 MI NVARCHAR
5 Pay code NVARCHAR
6 Hours NUMERIC(6,2)
7 Worked date in yyyy.mm.dd format NVARCHAR
8 Department NVARCHAR
9 Pay period start date in yyyy.mm.dd format NVARCHAR
10 Pay period end date in yyyy.mm.dd format NVARCHAR
11 Pay code type (P or S) NVARCHAR

A. Use a SQL query to create a table in the Workforce Central database


(kdemo) to hold the following fields: empid (6 characters), paycat 10
characters), hours (numeric with 2 decimal places). Use the suprkron
login with the password of skron96.
The query is shown below:
CREATE TABLE WIM_Temp1
(empid nvarchar(6),
paycat nvarchar(10),
hours numeric(8,2))

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-17


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Create a link to populate the new table and include preopen functions to
drop and create the table. You can copy the SQL you just wrote for the
SQL statements. Solution: LoadTemp1.KNX.
C. Complete the link to populate the new table with all of the rows in
PayrollSource.TXT except those where the pay code is one of the
summary pay codes. Call the link LoadTemp1. Hint: There is more than
one way to eliminate the summary pay categories.
1. How did you eliminate the summary pay codes?
_______________________________________________
2. Can you think of another way to accomplish the same task?
_______________________________________________
D. Disable the drop and create functions and run the LoadTemp1 link two
or three times in succession without clearing the data.
1. What happens?
_______________________________________________
E. Enable the drop and create functions and run the link again.
F. Create a SQL query that sums the hours by paycat. Include all of the
columns. Test the query using the SQL query tool.
G. Create a link that outputs the following for each employee: empid,
paycat, sum of the hours for the paycat. Make the output text, comma
delimited. Solution: PayrollOut.KNX.
H. Combine the links into a single interface file. Run the interface as a test.
Solution: SQLPractice.KNI.

Using SQL well

Let me: Using SQL well


In this practice you will investigate the difference that good SQL practices make in
interfaces.
A. Open the link BadSQL1.KNX. Make any modifications to the source as
instructed. Run the link. Mentally note the amount of time it takes to run.
B. Run the link GoodSQL1.KNX. Make any modifications to the source as
instructed. Run the link. Mentally note the amount of time it takes to run.
C. Extra challenge! Write a new link that extracts the same information as
that in GoodSQL1.KNX from the vp_allpersonv42 view without using
special lookup tables.

As this practice demonstrates, there can be a big difference in the performance of


an interface based on how SQL queries are used.

1-18 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Using SQL for the employee list

Let me: Change the sort order for a Workforce Central source
In this practice you will modify the SQL for the employee information to change
the default sort order.
A. Create a new link to extract information from Workforce Central for the
previous pay period. Enable the Use SQL for Employee List option and
change the sort order to be by last name. Include the following fields in
your fixed length text file output. Solution: WTKUseSQL-A.KNX.

Data Element Length


Employee Number 5
Name 25
Primary Labor Account 20
Pay Code Name 15
Acct Worked Category (Hours) 8

B. Change the sort order to be by labor level 2 of the employee’s home


account. Solution: WTKUseSQL-B.KNX.
C. Clear the Use SQL for employee list option and use the Workforce
Integration Manager sorting feature on the output tab to sort by the
Name field.
D. Change the sort order to be by labor level 2 of the employee’s home
account. The output however should include the full primary labor
account name. Remember to use the sort feature found on the output
tab.

Filtering the Source

Let me: Using SQL to filter data


In this practice you will modify the Workforce Integration Manager SQL to filter the
data before it leaves the Workforce Central database.
A. Edit the WHERE clause in your previous link to include only employees
from location 202. Run the link and verify that the output was limited.
Solution: WTKUseSQL-C.KNX.

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-19


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Using variables in SQL queries

Let me: Using a variable in the SQL statement


In this practice you will use a variable in place of a hard-coded value in the
employee SQL statement.
A. Define a variable that will be used on the Source tab as part of the SQL
used for employee information. Call the variable :LOCATION. The action
is static text that is hard coded to a value of 202.
B. Edit the SQL on the Source tab to include the :LOCATION variable as
part of the WHERE clause. Solution: WTKUseSQL-D.KNX.

Let me: Creating a pick list for a variable


In this practice you will use the prompt user action to create a picklist from a SQL
query. You will then assign the selected value to a variable which is then used in
the employee SQL statement.
A. Change the action for the :LOCATION variable to be Prompt User with a
special lookup table for the Picklist. Use a SQL query to provide a list of
eligible values. Solution: WTKUseSQL-E.KNX.

Let me: Extracting custom data part 1


In this practice you will use the existing Custom Data field to extract available
custom data associated with employees.
A. Use the SQL tool to examine the CUSTOMDATADEF table in the
Workforce Central database.
1. What subfield will you use to extract the emergency contact information?
_______________________________________________
B. Create a link that outputs the employee ID, name, and emergency
contact information for all Workforce Central employees. The record
interval is one record per employee. Solution:
CustomData1Solution.KNX.
C. Extra challenge! Not all employees have emergency contact
information. Modify the link to output the message “No emergency
contact information!”.

1-20 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Let me: Extracting custom data part 2


In this practice you will add custom fields to the employee SQL query.
A. Create a link that outputs the employee ID, name, home phone, and cell
phone. The record interval is one record per employee. You will need to
add the fields for home phone and cell phone to the SQL for the
employee list. Reference them as C1 and C2 respectively. Use the
Workforce Timekeeper database. Not all employees have a cell phone
number. Solution: CustomData3Solution.KNX.
B. Extra challenge! Add the employee’s birth date to the link as C3. The
birthdate should have the format “Jan 1” with no year included.
Solution: CustomData3ASolution.KNX.
C. Extra challenge! Sort the output in Practice B above so that birthdays
occurring on January 1 are at the top of the list and those occurring on
December 31 are at the bottom. Solution: CustomData3CSolution.KNX.
D. Extra challenge! Add custom field C4 as being the date the employee
joined the 401K program. Include it in the output. The value is identified
by the customdatetypeid field having a value of 1. Solution:
CustomData3BSolution.KNX.

Let me: Extracting custom data part 3


In this practice you will use a special lookup table to add custom data to an
extract.

A. Add another field which is the date the employee joined the 401K
program. Include it in the output. Use a special lookup table to
accomplish the task. The value comes from the
vp_personcustdata.customdatetime column and is identified by the
customdatetypeid field having a value of 1. Additionally, include the
message “Not in 401K plan” if the date is blank. Solution:
CustomData4Solution.KNX.

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-21


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Running stored procedures

Let me: Stored Procedures


In this practice, you will examine how stored procedures are used in links.
A. Examine the WFHRMS_CalcAccruals.KNX link. Locate the stored
procedure.

Let me: Stored procedures


In this practice you will examine a link that executes a stored procedure that select
data from a database.
A. Examine the sp_example.KNX link. Locate the stored procedure. Run
the link and examine the output.

Module 4: Case Studies

Lesson 1: Using interim tables

Let me: Extracting the data


In this practice you will explore the first link in the interface. The purpose of the link
is to extract data from Workforce Central and store it in a temporary database.
A. Create the database connection to the Workforce Central database
specified by the instructor.
B. Change the working directory to the Link 1 folder.
C. Modify WFC_Extract-A.KNX to use the database connection created in
Step A above.
D. Examine the various aspects of the link.
E. Run the link and examine the two output files.

Let me: Loading the table


In this practice you will explore the link that extracts data from the temporary
database.
A. Create a database connection to point to the temporary database.

1-22 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Open WFC_Extract-B.KNX.
C. Examine the various parts of the link described by the instructor.
D. Modify the link to use the database connection you defined in Step A.
E. Run the second link and use the SQL query tool to examine the
temporary table.

Let me: Creating the final output


In this practice you will complete the next link in the interface.
A. Open the link WFC_Extract-C.KNX.
B. Copy the SQL query from the Source tab and paste it into the SQL query
tool. Run the query.
C. Examine the various parts of the link described by the instructor.
D. Modify the link to use the database connection you defined earlier.
E. Run the final link and examine the output.

Let me: Creating the interface


In this practice you will explore the interface that ties the three links together into a
single object.
A. Open the interface WFC_Extract.KNI.
B. Examine the various parts of the interface described by the instructor.
C. Modify the interface to use the necessary values for the variables.
D. Run the interface and examine the output.

Tracking changes in the data

Let me: Tracking changes


In this practice you will create variables to track changes in data. Additionally, you
will make decisions based on the changes.

A. Build a simple link to track the change of the employee ID in the


VP_TOTALS table of the Workforce Central database. Track the current
value and one previous value. Name the variables :Current ID and
:Previous ID. The output should contain three data elements: the
original value and the value of each of the variables. The data elements
and a partial output are shown below.

Data Element Comments


Original Data The first field transferred from the source
Current ID The contents of the variable :CurrentID
Previous ID The contents of the variable :PreviousID

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-23


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

303,303,
28,28,303
25,25,28
Use the following SQL statement as your source; the Distinct modifier
ensures that you only get each employee ID once so it is easier to track
changes. Solution: Tracking1.KNX.
Select distinct(personnum) from vp_totals

1-24 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Write a link to track only the current and previous values of the
employee ID in the comma delimited file Practice1BIn.TXT. The source
file has three fields: employee ID, labor level, and pay category. Use a
Boolean to check if there has been a change in the employee ID only. If
the ID has changed, output the static text “New ID”, otherwise output
“Same ID”. Solution: Practice1B.KNX.

Data Element Comments


Emp ID The contents of the employee ID field
Previous ID The employee ID found in the previous record
New or Same The results of the calculation checking for a change in ID

1,0,New ID
1,1,Same ID
1,1,Same ID
1,1,Same ID
1,1,Same ID
2,1,New ID
2,2,Same ID
C. Extra Challenge! Add a variable to track and output the ID from the next
oldest record. This means that you will have three variables and four
output fields. Sample output is shown below. This applies to practice
‘A’. Solution: Tracking2.KNX.
303,303,,
28,28,303,
25,25,28,303
45,45,25,28

Let me: Tracking changes part 2


In this practice you will use variables to track changes involving two fields

A. Write a link to track the combined change in ID and labor level in the
comma delimited file Practice1BIn.TXT. The source file has three fields:
employee ID, labor level, and pay category. As before, use Booleans to
check for the change. Output a message that indicates whether or not a
change of the combination of employee ID and labor level has taken
place. Use either method discussed. Solution: Practice1C.KNX.

Data Element Comments


EmpID The contents of the employee ID field
Labor Level The contents of the labor level
Change The results of the calculation checking for a change in
employee ID and/or labor level

1,A,New combined
1,A,Combined Same
1,B,New combined
1,B,Combined Same
1,C,New combined
2,A,New combined
2,B,New combined

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-25


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

B. Use a different method to accomplish the task posed in “A”.


C. Extra challenge! Modify the link to output a message that indicates what
has changed. The possible outcomes are New ID, New LL, or Same.
Solution: Practice1C.KNX.
1,A,New combined,New ID
1,A,Combined Same,Same
1,B,New combined,New LL
1,B,Combined Same,Same
1,C,New combined,New LL
2,A,New combined,New ID
2,B,New combined,New LL

Tracking unique pay codes

Let me: Implementing counters


In this practice you will create a counter and use it in a link.

A. Create a link that extracts the employee ID, pay code, and hours from
the Payroll table in the HGPayroll database. Include a counter for each
pay code that increments until the employee ID changes. Pay codes can
be repeated in the output. A sample of typical output is shown below.
Hint: Only one link is needed. Solution: Counter_example.KNX.

Data Element Comments


Emp ID The contents of the employee ID field
Counter The counter
Pay code The pay code
Hours The number of hours for the pay code

Use the following SQL statement:


Select empid, paycode, hours
from payroll
Order by empid, paycode
10,1,All Hours,8.00
10,2,All Hours,8.00
10,3,Sick,8.00
104,1,All Hours,8.00
104,2,Hol-Credit,8.00
105,1,All Hours,8.00
B. Extra challenge! Modify the link so that only primary pay codes are
included in the output, summary pay codes are not included.

1-26 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Lesson 2: How to store data from a previous record

Let me: Multi-line records


In this practice you will examine a link that stores values from previous records in
a multi-line record.
A. Open the link, MasterFileSolution.KNX and examine the variables.
B. Open the source, MasterFileOut.TXT, and examine the layout. Mentally
determine what the value of each variable would be as the link reads
each record.
C. Examine the qualifiers for the link.
D. Modify the link to point to the Workforce Central server. Run the link and
verify that the data was imported into Workforce Central. You can verify
that the interface was successful by locating any of the following names
using the WFC QuickFind feature: Dowd, Ellsworth, Hook, Kirkland,
Knarr, Pan, Turner, Wells. Their Employee ID’s are all in the 500s.

Lesson 3: Creating an interface with interim tables

Let me: Using temporary tables


In this practice you will create an interim database table and load the data into the
temporary table.
A. Create the necessary database connection for the temporary table. Use
the Link 2 folder as the working directory.
B. Create the link that extracts and filters the data from Workforce Central,
creates the interim table, and loads the data into the interim table.
Solution: WTK_WeeklyExport-A.KNX.
C. Run the link and view the temporary table with the SQL query tool.

Let me: Using temporary tables


In this practice you will complete the interface by extracting data from the interim
table. You will also track changes in employee ID to determine which record to
output.
A. Create the second link as specified. Solution
WTK_WeeklyExport-B.KNX.
B. Combine the links into an interface and use variables for the database
connections and mapped folders.

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-27


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Lesson 4: Creating an interface with limited data elements


How to approach the problem

Let me: Creating indefinite records


In this practice you will create an interface that requires multiple links to complete
the task. Use variables, functions, temporary databases, and anything else you
need.
A. Create a new link and define the source. Use the file PolyShiftTest.TXT
as the source file. This file contains sample data for testing. Examine the
file so you understand what test scenarios it presents.
Employee 1 has 13 shift segments for 03/01/09 and 5 shift segments for
03/02/09. Employee 2 has the same number of shifts as employee 1 for
the same dates.
B. Define the output for the link. It should be a delimited text file.
C. Create the four records for the link. Name each record descriptively,
clearly identify which are the base records and which are the extension
records. Include a static text identifier for each record.

Base record layout

Field Description
Employee ID The employee ID
Date The date of the shift segment
Identifier Contains static text like “BR1” to identify the record

Extension record layout

Field Description
Start time Start time from the file
Duration Duration from the file
Labor level Concatenated labor level information
Identifier Contains static text like “BR1” to identify the record

1-28 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

D. Create the variables for the link.

Variable Description
Employee ID Transfer from the source.
Date Transfer from the source.
Start time Transfer from the source.
Duration Transfer from the source.
Labor level data Calculation to concatenate the five field with slashes.
Example: 101/201/301/401/501
Previous employee ID Used to track changes. Do in a calculation.
Current employee ID Used to track changes.
Previous date Used to track changes. Do in a calculation.
Current date Used to track changes.
Same employee ID? Calculation that returns either “SAME” or “DIFFERENT”.
Compares previous ID and current ID.
Same date? Calculation that returns either “SAME” or “DIFFERENT”.
Compares previous date and current date.
New tour? Calculation that returns either “SAME” or “DIFFERENT”.
Only return “SAME” if both the date and the employee ID
have not changed from the previous record.
Tour count Calculation that increments by 1 if the tours is the same.
Resets to 1 if New Tour? is “DIFFERENT”.
Between 1 and 6? “TRUE” if the tour count is between 1 and 6. “FALSE”
otherwise.
Between 7 and 12? “TRUE” if the tour count is between 7 and 12. “FALSE”
otherwise. Returns a calculation failure if greater than 12.
Base record 2 “TRUE” is the tour count is equal to 7.

Let me: Using qualifiers


In this practice you will define and troubleshoot qualifiers for each record.
A. Disable all records except base record 1. Define the qualifier(s) run the
link and examine the output. Debug as needed.
B. Enable the first extension record. Define the qualifier(s) run the link and
examine the output. Debug as needed.
C. Enable the second base record. Define the qualifier(s) run the link and
examine the output. Debug as needed.
D. Enable the second extension record. Define the qualifier(s) run the link
and examine the output. Debug as needed. Solution: PolyLink-A.KNX.
E. Add an error message and record identifier if the tour count is greater
than 12. Use variables to create the record identifier that has the
employee ID.

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-29


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Lesson 5: Learning good habits

Guide me: Describing poor programming practice


In this practice you will examine a link that has incorporated several poor
programming techniques. Try to avoid these practices.
A. Open the link BadWIM1.KNX. Examine the link and point out problems
with it.

Let me: Correcting poor link design


In this practice you will attempt to troubleshoot a poorly programmed link and
correct the problem. This should help you recognize and appreciate the
importance of using sound link writing techniques
A. Debug the link BadWIM1A.KNX. It contains a single error that prevents it
from functioning correctly. When corrected, the output should match
that of BadWIM1.KNX.

1-30 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Appendix: SQL Refresher


SELECT

Guide me: Using the SELECT statement


In this practice you will use various forms of the SQL SELECT statement.

A. Investigate the various forms of the SELECT statement by entering the


following queries against a Workforce Timekeeper database using the
tool supplied by the instructor.
1. SELECT * FROM VP_EMPLOYEEV42
2. SELECT
FIRSTNM, LASTNM, BADGENUM, PAYRULENAME
FROM
VP_EMPLOYEEV42
3. SELECT DISTINCT PAYRULENAME FROM VP_EMPLOYEEV42
4. SELECT NAME FROM PAYRULE
5. Notice PAYRULE table list all defined codes. VP_EMPLOYEEV42 lists all
used codes.

WHERE

Guide me: Using the WHERE clause


In this practice you will use various forms of the SQL SELECT statement with a
WHERE clause.

A. Investigate the various forms of the SELECT statement by entering the


following queries against a Workforce Timekeeper database using the
tool supplied by the instructor.
1. SELECT
FIRSTNM, LASTNM, BADGENUM, PAYRULENAME
FROM
VP_EMPLOYEEV42
WHERE
PAYRULENAME = 'Full Time'
2. SELECT
FIRSTNM, LASTNM, BADGENUM, PAYRULENAME
FROM
VP_EMPLOYEEV42

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-31


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

WHERE
PAYRULENAME != 'Full Time'
3. SELECT
FIRSTNM, LASTNM, BADGENUM, PAYRULENAME
FROM
VP_EMPLOYEEV42
WHERE
PAYRULENAME <> 'Full Time'
4. SELECT
FIRSTNM, LASTNM, BADGENUM, PAYRULENAME
FROM
VP_EMPLOYEEV42
WHERE
PAYRULENAME LIKE 'Pro%'
5. SELECT
FIRSTNM, LASTNM, BADGENUM, PAYRULENAME
FROM
VP_EMPLOYEEV42
WHERE
PAYRULENAME NOT LIKE 'Full%'
AND PAYRULENAME NOT LIKE 'Pro%'
6. SELECT
FIRSTNM, LASTNM, BADGENUM, BASEWAGEHOURLYAMT
FROM
VP_EMPLOYEEV42
WHERE
BASEWAGEHOURLYAMT > 0

ORDER BY

Guide me: Using the ORDER BY clause


In this practice you will use various forms of the SQL SELECT statement with
ORDER BY.

A. Investigate the various forms of the SELECT statement by entering the


following queries against a Workforce Timekeeper database using the
tool supplied by the instructor.
1. SELECT
FIRSTNM, LASTNM, BADGENUM, PAYRULENAME
FROM
VP_EMPLOYEEV42
ORDER BY
PAYRULENAME, LASTNM ASC
2. SELECT
FIRSTNM, LASTNM, PAYRULENAME, COMPANYHIREDTM
FROM
VP_EMPLOYEEV42
WHERE
COMPANYHIREDTM BETWEEN '1/1/1990'
AND '12/31/1999'
ORDER BY
PAYRULENAME, LASTNM ASC
3. Notice that the smaller value must come first in the BETWEEN clause.
4. SELECT
PERSONFULLNAME, HOMELABORLEVELNM2
FROM

1-32 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

VP_EMPLOYEEV42
WHERE
HOMELABORLEVELNM2 IN ('201', '202', '203')
ORDER BY
HOMELABORLEVELNM2, LASTNM ASC

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-33


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

Useful Functions

Guide me: Other SQL functions


In this practice you will use various SQL functions.
A. Investigate some handy SQL functions that can be incorporated into
SQL queries.
1. SELECT LASTNM, LEN(LASTNM) FROM VP_EMPLOYEEV42
2. SELECT LASTNM, LEFT(LASTNM,6) FROM VP_EMPLOYEEV42
3. SELECT UPPER(LASTNM) FROM VP_EMPLOYEEV42
4. SELECT
DATEPART(YEAR, COMPANYHIREDTM)
FROM
VP_EMPLOYEEV42
5. SELECT
COMPANYHIREDTM,
DATEADD(MONTH, 6, COMPANYHIREDTM)
FROM
VP_EMPLOYEEV42
6. SELECT
COMPANYHIREDTM, DATEDIFF(YEAR, COMPANYHIREDTM,
GETDATE())
FROM
VP_EMPLOYEEV42
7. SELECT
WORKEMAILADDRESS,
CHARINDEX('@', WORKEMAILADDRESS)
FROM
VP_ALLPERSONV42
8. SELECT
WORKEMAILADDRESS,
LEFT(WORKEMAILADDRESS,
(CHARINDEX('@', WORKEMAILADDRESS)-1))
FROM
VP_ALLPERSONV42
9. SELECT
LASTNM, REVERSE(LASTNM)
FROM
VP_ALLPERSONV42
10.SELECT
LASTNM, LEFT(LOWER(REVERSE(LASTNM)),8)
FROM
VP_ALLPERSONV42

1-34 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

HAVING

Guide me: Reviewing the SELECT statement


In this practice you will use various forms of the SQL SELECT statement.

A. Next, investigate some SQL aggregate functions that can be


incorporated into SQL queries. Remember that when you use aggregate
functions, every field in the SELECT statement must be either included
in the GROUP BY clause or use an aggregate function.
1. SELECT
HOMELABORLEVELNM2,
AVG(BASEWAGEHOURLYAMT) AS AVG,
MIN(BASEWAGEHOURLYAMT) AS MIN,
MAX(BASEWAGEHOURLYAMT) AS MAX,
COUNT(BASEWAGEHOURLYAMT) AS COUNT,
SUM(BASEWAGEHOURLYAMT) AS SUM
FROM
VP_EMPLOYEEV42
GROUP BY
HOMELABORLEVELNM2
2. SELECT
HOMELABORLEVELNM2,
AVG(BASEWAGEHOURLYAMT) AS AVG,
MIN(BASEWAGEHOURLYAMT) AS MIN,
MAX(BASEWAGEHOURLYAMT) AS MAX,
COUNT(BASEWAGEHOURLYAMT) AS COUNT,
SUM(BASEWAGEHOURLYAMT) AS SUM
FROM
VP_EMPLOYEEV42
GROUP BY
HOMELABORLEVELNM2
HAVING COUNT(BASEWAGEHOURLYAMT) > 3
3. SELECT TOP 10
PERSONFULLNAME,
BASEWAGEHOURLYAMT
FROM
VP_EMPLOYEEV42
ORDER BY
PERSONFULLNAME
4. TOP n or TOP n PERCENT is good for testing

© 2015, Kronos Incorporated or a related company. All rights reserved. 1-35


Workforce Integration Manager
Advanced Interface Programming
Practice Exercises

1-36 © 2015, Kronos Incorporated or a related company. All rights reserved.


Workforce Integration Manager
Advanced Interface Programming

You might also like