Case: Create a database (system) for a user to request for an email and update in names.nsf.
Problem found, let say we can't edit names.nsf view or create a new view just to check the uniqueness of Internet address.
sample: InternetAddress (Email address) field of a user is: TestUser1@brooke.com.my
I can't use picker validator just to validate the uniqueness of email address as there has no view and not allow to create a view in names.nsf just to sort it and use it for validation, May I know got another way to do validation~?
Sample value inside arr
New Coding Added on 19/07/2017
var setdoc:NotesDocument = database.getProfileDocument("System Setting", "");
var server = setdoc.getItemValueString("DBSvr");
var DName = setdoc.getItemValueString("DbPath");
var db:NotesDatabase = session.getDatabase(server, DName, false);
var vw:NotesView = db.getView("($VIMPeopleByLastName)")
var doc:NotesDocument = vw.getFirstDocument();
var arr = [];
while (doc != null) {
var tmpdoc = vw.getNextDocument(doc);
arr.push(doc.getItemValueString("InternetAddress"));
doc.recycle(); // to prevent IBM Notes Crash use recycle // The recycle method unconditionally destroys an object // and returns its memory to the system.
doc = tmpdoc;
}
value=getComponent("mail11").getValue() +"@devsvr1.pcs.com.my"
return @IsMember(value, arr);
Newer Testing result:
-property of the field
-validation property field
-Coding part
<xp:this.expression><![CDATA[#{javascript:
var setdoc:NotesDocument = database.getProfileDocument("System Setting", "");
var server = setdoc.getItemValueString("DBSvr");
var DName = setdoc.getItemValueString("DbPath");
var db:NotesDatabase = session.getDatabase(server, DName, false);
var vw:NotesView = db.getView("($VIMPeopleByLastName)")
var doc:NotesDocument = vw.getFirstDocument();
var arr = [];
while (doc != null) {
var tmpdoc = vw.getNextDocument(doc);
arr.push(doc.getItemValueString("InternetAddress"));
doc.recycle();
doc = tmpdoc;
}
value=getComponent("mail11").getValue() +"@devsvr1.pcs.com.my"
return @IsMember(value, arr);
}]]></xp:this.expression>