This topic is locked

Selective Field

12/11/2009 2:11:31 AM
PHPRunner General questions
A
ashumak author

I have a field called serial_number. It will be selected using lookup wizard from another table. I want to allow it to only use each "number once" except for a dummy number (for those without serials, or in repair)or two which are allowed duplicates.
Suggetions on how to create /setup this concept?

J
Jane 12/11/2009

Alan,
check Unique values option on the "Edit as" settings -->Lookup wizard dialog.

A
ashumak author 12/12/2009



Alan,
check Unique values option on the "Edit as" settings -->Lookup wizard dialog.


I seee where you are talking about...so I click Unique Values, and then how would I tell it that they should be unique, except for two alternative numbers?

Sergey Kornilov admin 12/12/2009

I'm afraid it's not possible. It either displays all values or hides all duplicates.

A
ashumak author 12/13/2009



I'm afraid it's not possible. It either displays all values or hides all duplicates.


if ( "$values[serial]" == "$oldvalues[serial]" ) {
return true;
}
elseif ( "$values[serial]" == "TCC_Repair" ) {
return true;
elseif ( "$values[serial]" == "SWAP" ) {
return true;
elseif ( "$values[serial]" != "$oldvalues[serial]" ) {
//** Check if specific record exists ****

global $conn;

$strSQLExists = "select serial from employee where serial ='$values[serial]'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);
if($data) {

$message = "<div class=message>The serial: \"$values[serial]\"

is already in the system - Terminal not updated!!!</div>";

return false;

} else {

return true;

}
}

Took this from another string...would it work? Where would it go?