Use parameter in Select Component

Primary tabs

Hello everyone,

I want to fill data into my select component with sql request and parameter.

I tried to follow this example https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY... 

I need to call a method because my parameter can be different. I tried something like this but it doesn't work... 

ClientMethod changeParams() [ Language = javascript ]
{


var query zenPage.getComponentById('categorieBeneficiaire');
query.setProperty('parameter', 1, 'OS');
query.setProperty('parameter', 2, 'NSAL');
}

or like this : 

ClientMethod changeParams() [ Language = javascript ]
{


var query zenPage.getComponentById('categorieBeneficiaire');
var param1 zenPage.getComponentById('catBParam1');
var param2 zenPage.getComponentById('catBParam2');


param1.value='OS';
param2.value='NSAL';
    query.executeQuery();
}

You can see my select here : 

<select id="categorieBeneficiaire" label="Catégorie bénéficiaire " sql="SELECT row FROM mytable where cond = and cond2= ?required="true" >
    <parameter id="catBParam1" />
    <parameter id="catBParam2" />
</select>

Answers

Try

ClientMethod changeParams() [ Language = javascript ]
{
  var query zen('categorieBeneficiaire');
  var param1 zen('catBParam1');
  var param2 zen('catBParam2');

  param1.value='OS';
  param2.value='NSAL';
  query.refreshContents();
}

/// This client event, if present, is fired when the page is loaded.
ClientMethod onloadHandler() [ Language = javascript ]
{
  zenPage.changeParams();
}