Article
Problem
A Forum reader recently asked:
"On a event, I'm doing a query for a user object. If the query does not return an empty string, I want to put a form.alert. The query looks like this:
var v = IDVault.globalQuery("idesist", "QUser", {LOGINID:form.getValue("loginid")});
How do I check for the return to be non-empty and the user to get the function form alert?"
And here's the response from Rudy Duym ...
Solution
This expression:
var v = IDVault.globalQuery("idesist", "QUser", {LOGINID:form.getValue("loginid")});
returns an array with 2 entries, each being also an array of values. The result will also be stored in the field "idesist", which corresponds to the first parameter value.
The first entry on the array contains the dn values returned by the query. You get the first value of this array with a v[0][0]. You can also loop over the values, of course.
The second entry contains the cn part of the dn values returned by the query. You get the first value of this array with a v[1][0].
So if you want to test whether a non-empty value was returned, you can use something like this:
var v = "";
try {
v = IDVault.globalQuery("idesist", "QUser", {LOGINID:form.getValue("loginid")});
} catch (e) {};
if (v.length > 0 && v[0].length > 0 && v[0][0] != "") {
// non empty result
}
Note: As a field destination is specified, the result of the query will also be automatically stored in the field "idesist"!
Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).
It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.
Related Articles
User Comments
- Be the first to comment! To leave a comment you need to Login or Register
- 3997 reads


0