Manage Learn to apply best practices and optimize your operations.

Prevent Duplicate Field Values - On Input Validation

This tip helps you prevent users from entering duplicate field values. It does
this via a input validation formula. It will work regardless of upper/lower
case used by user.

It assumes that you have a field called "location" that must be unique in the
database and is required field.

You must have a hidden view called "delaer_locations" with the first column as
sorted, with formula value @Lowercase (location) and the second column with
formula value @Text ( @DocumentUniqueID ).
Input Translation formula:

@Trim ( location )

Input Validation formula:

REM "this is a required field that can have no duplicates";
temp := "";
@If ( location = ""; @Failure ( "Location is required" );
@Do (
@Set ( "temp"; @DbLookup( "":"NoCache"; "":""; "dealer_locations";
@LowerCase (location); 2) );
@If ( [email protected] ( temp);
@If ( @Elements( temp) !=1; @Failure ( "More than one Location already
exists" );
temp != @Text (@DocumentUniqueID); @Failure ("Location already
exists"); @Success);
@Success ) ) )

Dig Deeper on Lotus Notes Domino Administration Tools

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...