#value, #code for Picklist values in SelectQuery API

Posted by bakar on 06-Jul-2015 03:53

The following query returns the #value of the Picklist:

select locale#value from mytable

returns: "nl"

But when I use some MySQL functions, this always returns the ID:

select concat('locale = ', locale#code) from mytable

returns: "locale = 1234567"

Why is that?


All Replies

Posted by Sharavan Kumar on 06-Jul-2015 04:25

Hi ,

I have tried #value and #code in selectQuery API for picklist fields such as 'country' picklist and  observed that values are returned correctly.

rbf_selectQuery("select country_picklist#code from test_QueryApi", 1000, function my_callback(d){

console.log(d);

});

returns : UK , US , etc

rbf_selectQuery("select country_picklist#value from test_QueryApi", 1000, function my_callback(d){

console.log(d);

});

returns : "united Kingdom" , "United states" , etc

Thanks,

Sharavan

Posted by bakar on 06-Jul-2015 05:51

Try to use a Mysql function in your selectquery, then you should face the same situation

Posted by Anoop Premachandran on 06-Jul-2015 06:08

#value, #code are expressions interpreted  in Rollbase layer (evaluated in Rollbase code). If you use MySQL functions they will be evaluated at MySQL layer where only code is stored in the database column. As of now we do not support functions like concat to be interpreted at Rollbase layer.

Posted by Anoop Premachandran on 06-Jul-2015 06:12

I would suggest that you do concat in JavaScript while processing the results from the SelectQuery.

This thread is closed