Change a Numeric to a Labor Prompt - TWP

If you have mistakenly set a numeric prompt to collect labor values, (like department or location), and the prompt has already collected data that you want to keep, this article will explain how you can transfer that data into a new prompt.

The reason you need this script is that once you create a prompt, you can't change the type from Numeric to Labor. So the only solution is to create a new prompt that your client will use going forward and copy any existing data into this new prompt.

NOTE: If you need to change a Labor Prompt to a Numeric Prompt, the process is similar with some mild changes. Check out Change Labor to Numeric Prompt for information on that process.

Prompt Types

Clock prompts come in two types, labor and numeric.
Labor is used for recording an attribute of hours worked, like department or, job code. X, Y, Z and Web Only (Labor) are designated as labor prompts.
Numeric is used for values that need to be totaled, like tips, piece work, rooms cleaned or commission. I, J, K and Web Only (Numeric) are designated as numeric prompts.

Copying Data from One Prompt to Another

Once you create a prompt, there is no way to change the type. Instead, you will need to create a new prompt and use a script to copy data from the incorrect prompt to the new prompt. Follow these steps if you need to convert numeric prompt entries into a labor prompt. NOTE: When you reach the scripting portion, we use Field Name as a placeholder for your prompts field names. You will need to substitute in your prompt names in the sample script.

1 – Create a Labor Prompt

In the Processing Rules, select Clock Prompts. First, make a note the Field Name of the incorrect prompt. Then create your new labor prompt with the Add Prompt button. You need to give this new prompt a different Field Name than your original prompt. However, you can use the same display name in the Column Header Text.
Here is an example of a labor clock prompt set to collect Dept when an employee clocks in. Your new prompt should look similar to this.

A labor prompt set to collect departments

2 – Modify the Following Script with Your Prompt Fields Names

Copy the following script into a simple text editor like Notepad (or Notepad++ if you have it). Do not use Microsoft Word or any other programs that uses smart quotes (curved instead of straight quotation marks).
if(val(FieldName1) > 0 and isedited("FieldName2") = false){
   FieldName2 = val(FieldName1);
Next, replace the FieldName placeholders with the field names of your sites clock prompts:
FieldName1 refers to your original numeric prompt.
FieldName2 refers to the new labor prompt. 

3 – Put the Script in Place

The script needs to be put
in the Pay Rate Script box
After you have modified the script with your field names, copy and paste it into the PayRateScript Rule. This rule is found in the Processing Rules under the Scripting category.
After pasting the rule into the script box, save it. For any unfinalized pay period*, the data from the old prompt will be copied to the new prompt.
*Scripts have no effect on finalized pay periods. If you are trying to perform this fix on a finalized pay period, you will need to unfinalize and then finalize so that the script can make the changes.

4 -- Hide the Old Prompt (optional)

It's probably wise to hide the old prompt so that it is no longer used by employees or managers when editing the time card. The easiest way to do this is to make the prompt Not Visible/Not Editable.

Did you find this article helpful?