Change a Labor to a Numeric Prompt - TWP

If you have mistakenly set a labor prompt to collect numeric values, (like tips or mileage), 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 Labor to Numeric. 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 Numeric Prompt to a Labor Prompt, the process is similar with some mild changes. Check out Change Numeric to Labor 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 labor prompt entries into a numeric prompt.

NOTE: When you reach the scripting portion, we use FieldName as a placeholder for your prompt field names. You will need to substitute in your prompt names in the sample script.
The Field Name, not the column header
name, should be used in scripting

When you reach the scripting portion, use the Field Name of your prompts in place of the variables in the sample script.

1 – Create a Numeric Prompt

In the Processing Rules, select Clock Prompts. First, make a note the Field Name of the incorrect prompt. Then create your new numeric 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 name in the Column Header Text.
Here is an example of a numeric clock prompt set to collect tips when an employee clocks out. Your new prompt should look like this.

A numeric prompt set to collect tips

3 – 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 = Field Name of the original, labor prompt
FieldName2 = Field Name of the new, numeric prompt

4 – 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

It's wise to hide the old prompt so that it is no longer used by employees or managers 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?