Official comment
Hi Cristina,
Is this a custom page that you're building via Settings >> Configure?
Best regards,
Roland
I need to pass a parameter to a where clause in CZQL.
Example from the Home page I want to retrieve all projects for the current user, where Project Geo is equal to User Geo but I don't know how to pass to user geo in the where condition:
performQuery("select count() as cnt, C_ResourceAlignment from project where C_GeoPickList = {CurrentUser().C_Geo}
I tried to put it in a variable, but I don't know how to pass the variable the same.
Thanks
Hi Cristina,
Is this a custom page that you're building via Settings >> Configure?
Best regards,
Roland
Please sign in to leave a comment.
Hi Roland, yes it is a custom page I created under Organization Object
Thanks,
Cristina
Hi Cristina,
You can pass the current user's C_Geo field value to your script like this:
I hope this helps.
Best regards,
Roland
Thank you Roland,
It works!
Hi,
sorry, another question, if I want to pass to the query (in the where clause) a value selected from a dropdown list? Is it possible?
Example:
<select id="myGeo">
<option value="WW">WW</option>
<option value="EMEA">Emea</option>
<option value="JAPAN">Japan</option>
</select>
performQuery("select count() as cnt, C_OverallProjectHealth from project where C_GeoPickList in( " + myGeo +") group by C_OverallProjectHealth");
What I have to insert in place of myGeo?
Thank you,
Cristina
Hi Cristina,
This is not a Clarizen-specific question. This is a JavaScript question. There's many ways of doing this. Here's a simple example:
HTML:
<select id="myGeo" onchange="valSelected()">
<option value="WW">WW</option>
<option value="EMEA">Emea</option>
<option value="JAPAN">Japan</option>
</select>
JS:
let valSelected = () => {
let myGeo = document.getElementById("myGeo").value;
performQuery("select count() as cnt, C_OverallProjectHealth from project where C_GeoPickList in( " + myGeo +") group by C_OverallProjectHealth");
}
I hope this helps.
Roland
Hi Roland,
thank you for your suggestion, I have resolved with JQuery:
$('#myGeo').change(function(){
var a =($(this).val());
performQuery("select count() as cnt, C_OverallProjectHealth from project where C_GeoPickList in( '" + a + "') group by C_OverallProjectHealth");
})