Change description of Category of Calendar

I tried to change Category field with query in field “Category” from Calendar aplication. I need to put between “( )” the sumary of events from this month and year, but I have two problems:

1.- The first time when load calendar the category it done ok, but when change of month from button calendar my Category it don’t update.

In my field Category put this script in Lookup

SELECT ID_LUGAR, LUGAR ||’ (’||
(
Select count(he.id_even)
from hevento he
where he.id_salon= [var_salon]
and he.estado in (1,2,3,4)
and Extract(year from he.fechahora) = [var_aniofecha]
and Extract(month from he.fechahora) = [var_mesfecha]
)
||’)’ FROM MLUGAR
WHERE ID_SALON = [var_salon]
ORDER BY 2

I need to know what variable to get to “month” and “year” to replace my variable “[var_aniofecha]” and “[var_mesfecha]”;

2.- How to replace in my sql script the variable that of the current month and current year from calendar, what sintax is correct with “{variable}” or “[variable]” and is necesary to reload this variables on someone event from calendar (onLoad, onscriptinit, etc.)

Any ideas how to solve this?

Thank you.

pantalla_categoria.jpg

I found this function in code of Calendar application, but when I try to execute in sc I don’t to get to update the value of Category.


function refreshFilterCategories() {
                $('#calendar').fullCalendar('removeEventSource', 'Calendar.php?script_case_init=6211&nmgp_opcao=calendar_fetch' + getCategory(false));

                setCategory();

                $('#calendar').fullCalendar('addEventSource', 'Calendar.php?script_case_init=6211&nmgp_opcao=calendar_fetch' + getCategory(false));
        }

I put this code in event “onLoad” and “onValidateSuccess” but I could not change the text of the category when I navigate with the month buttons forward or backward.



sc_ajax_javascript('refreshFilterCategories()');
?>
<script type="text/javascript"> refreshFilterCategories();</script>
<?php

How to access the function to update the category or header?

Any idea?

Thank you!!