I'm having trouble setting up a query to determine if a specific option (Value/code) is selected on a multi-select picklist.
eg: object: AdminRole, Field: adminRoles, Value/Code: "Admin"...
I thought the below code would be close base on normal picklists,
(This is an unrelated control object)
var adminid = rbv_api.getIdByCode("AdminRole", "adminRoles", "Admin");
var curusr = {!#CURR_USER.id};
var adminct = rbv_api.selectNumber( "SELECT count(1) FROM AdminRole WHERE isAdminUserActive=true AND R34022=? AND adminRoles=?", curusr, adminid);
However I am getting an Error:
Error Error in SQL Query
SELECT count(1) FROM lxtt_tsAdminRole WHERE isAdminUserActive=true AND R34022=? AND adminRoles=?
[DataDirect][OpenEdge JDBC Driver][OpenEdge] Invalid long datatype column reference (7682) (line #6) [Object: "TS Control" TS Control: Active] in formula:
Is there a simple way from a query to tell if an option is selected in a multi-select picklist??? (Not much good to anyone if we can't do this..)
Thanks in anticipation..
I have worked around this.
Created logical expression fields for each of the pick list options.
eg:
/* {!adminRoles#code} */
var adids = [{!adminRoles#id}];
var adid = rbv_api.getIdByCode("lAdminRole", "adminRoles", "Admin");
for (i = 0; i < adids.length; i++) {
if ( adids === adid ) {
return true;
}
}
return false;
Then referenced these other fields where required: (Edit/Delete/Actions etc)
eg:
curusr = {!#CURR_USER.id};
userhasadmin = Boolean(rbv_api.selectValue("SELECT usrHasAdminAccess FROM AdminRole where R34022 = ?", curusr));
return ( userhasadmin === true );
I have worked around this.
Created logical expression fields for each of the pick list options.
eg:
/* {!adminRoles#code} */
var adids = [{!adminRoles#id}];
var adid = rbv_api.getIdByCode("lAdminRole", "adminRoles", "Admin");
for (i = 0; i < adids.length; i++) {
if ( adids === adid ) {
return true;
}
}
return false;
Then referenced these other fields where required: (Edit/Delete/Actions etc)
eg:
curusr = {!#CURR_USER.id};
userhasadmin = Boolean(rbv_api.selectValue("SELECT usrHasAdminAccess FROM AdminRole where R34022 = ?", curusr));
return ( userhasadmin === true );