You are here: Overview > Checking KeyID Entries

Checking KeyID Entries

In addition to the following restrictions on KeyID values, you can use DAL to make sure that data entered conforms to a specific alpha and numeric format. For instance, KeyIDs can be:

Note KeyIDs are typically used as the policy, document, or form set number.

In version 10.2 and higher, you can use the VerifyKeyID hook to call a DAL script. Within the DAL script, the verification can be constant, or provide exceptions based on the Key1 (Company), Key2 (Line of Business), or the transaction code currently selected.

All the relevant WIP record information taken from the Form Selection window is available to the DAL script for examination. Simply use the available DAL functions like WIPKeyID, WIPKey1, or WIPFld.

Note The script can retrieve WIP values, but not change them.

You must handle any error messages using the MSG function.

To install the KeyID validation hook, include these INI options.

< AFEProcedures >
AutoKeyID = TRNW32->TRNVerifyKeyID
< VerifyKeyID >
Script = KeyID.DAL
OnCreate = Yes
OnUpdate = No

Option

Description

AFEProcedures control group

AutoKeyID

Enter TRNW32-->TRNVerifyKeyID as shown above to install the KeyID validation hook.

VerifyKeyID control group

Script

Enter the name of the script you want the system to use. Store this script in the DefLib directory specified for your master resource library (MRL).

If you omit this option, a message appears on the Form Selection window. You will have to exit and correct the INI file by either defining the script or removing the hook declaration.

OnCreate

This option defaults to Yes to indicate you want to call the script when creating a new form set via the Form Selection window.

To exclude newly-created form sets, set this option to No.

OnUpdate

This option defaults to No to indicate you do not want to call the script to verify the KeyID on transactions that have already been saved to WIP.

To verify WIP transactions as well, set this option to Yes.

The script can do whatever evaluation is necessary for validation purposes.

Here is an example DAL script that validates a KeyID using a format token string.

-------------------------------------------------------------------

* Define the format requirement in the fmt variable below.
* 9 - means numeric
* A - means alphabetic
* X - means alphanumeric
* * - means any character - not limited to alphabetic or numeric
* For example, if you need 4 numeric, followed by 2 alpha, followed
* by 2 numeric, followed by 2 alphanum, you would define:
* fmt = "9999AA99XA"
* The length of the overall format string is assumed to also define
* the required length of the key value.
* Note DAL does not support case sensitive string comparisons.
* Therefore, it assumes either case is sufficient and that if the
* key is required to be in uppercase, you have set the
* CaseSensitiveKeys option to No.
 
fmt="9999AA99XA"
 
* This next statement is used to get the KeyID prompt
name = GETINISTRING(,"DlgTitles", "KeyIDTitle", "Policy #");
 
val = WIPKeyID();
if (val = "")
* This is returned successfully because a blank key is going to 
* be handled by the Form Selection window anyway.
    return("Yes");
End
#l = len(fmt);
if (#l != len(val))
    msg(name, "Length must be " & #l & '.');
    return("No");
End
* Now example each character from right to left because we
* already have the length from the earlier check.
top:
if (#l = 0)
    goto done:
end
f = sub(fmt,#l,1);
g = sub(val,#l,1);
if (f = '9')
    if (NUMERIC(g) = 0)
        msg(name, "Position "& #l & " must be numeric.");
        return("No");
    end
elseif (f = 'A')
    if (g < 'A' OR g > 'Z')
        msg(name, "Position "& #l & " must be alphabetic.");
        return("No");
    end
elseif (f = 'X')
    if (NUMERIC(g) = 0)
        if (g < 'A' OR g > 'Z')
            msg(name, "Position "& #l & " must be alphanumeric.");
            return("No");
        end
    end
elseif (f != '*')
    msg("Invalid format found at position " & #l & ".");
    return("No");
end
#l -= 1;
goto top:
done:
return("Yes");
-------------------------------------------------------------------