#CALC_COUNT API doesn't work if the condition contains &

Posted by Rollbase User on 16-Feb-2010 16:21

#CALC_COUNT API doesn't work if the condition contains "#value".. To do server-side validation, for example I need the count of all records with permit_requested#value equal to White...: var count2 = #CALC_COUNT.bus_permits( 1 | permit_requested#value == 'White'); return count2; returns the following when debugged: Application Error Error in SQL Query formula=var count2 = #CALC_COUNT.bus_permits( 1 | permit_requested#value == 'White'); return count2; SELECT COUNT(1) AS X FROM RB_OBJ_DATA A WHERE A.OBJ_DEF_ID=7223607 AND (permit_requested#value = 'White') You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 However, if I remove the #value and just use: var count1 = #CALC_COUNT.bus_permits( 1 | permit_requested == 'White'); return count1; The formula returns 0 when debugged, as is expected because it's not comparing the right data. I need to use the #value

All Replies

Posted by Admin on 17-Feb-2010 00:58

Mike,

I do not believe the query API supports the #value syntax. Pavel is master of this domain, though he will not be available to answer questions until next Monday. Thanks for your patience on this

Matt

Posted by Admin on 17-Feb-2010 08:36

Matt-

I was able to remove the #value portion of the field and instead of comparing the value, I compare the ID (permit_requested).


var count2 = #CALC_COUNT.bus_permits( 1 | permit_requested == '7223707');


This seems to have done the trick.

Thanks,
Mike

Posted by Admin on 22-Feb-2010 21:47

You should be able to use integration codes for picklists and statuses as well as id. However please note that syntax for group functions is slightly different that for regular templates. Please refer to documentations (Chapter 6) for more details.

This thread is closed