I am trying to get a count of the number of related cases for current year on the client record that equal a specific case type and I am using the following:
#CALC_COUNT.R12466576( 1 | createdAt = YEAR && case_type = 5888137)
This only seems to be returning "0" on all records. If I remove the createdAt part it does count the records but for every year, which is not what the client wants.
I am currently on Version 2.2.2.0 but in the process of updating to Version 4.0.
I thought this was a no brainer. Any help is appreciated.
Thanks, Paul
Hi Paul,
"createdAt" is stored as "Date/Time" field in MySql database in the format "2016-03-15 15:47:36". This format has to be matched with variable YEAR.
You can also use rbv_api.selectValue API as follows:
var count=rbv_api.selectValue("SELECT COUNT(1) FROM Cases WHERE createdAt LIKE '2016%' AND naam='india'");
rbv_api.println(count);
Please let me know if you find any issue.
Regards,
Shiva