Home
Developing Analytics Applications
How to add a value to the SelectionList of a ScalarParameterHandle?
Migrateduser
<div>Hi,</div>
<div> </div>
<div>How can I add a value to the SelectionList of a ScalarParameterHandle?</div>
<div> </div>
<div> </div>
<div>I am creating a rptdesign using DEAPI and have added a scalar parameter to the design as follows:</div>
<div> </div>
<div>
<pre class="_prettyXprint">
ScalarParameterHandle sph = design.getElementFactory().newScalarParameter("MyScalarParameter");
sph.setDataType(DesignChoiceConstants.PARAM_TYPE_INTEGER);
sph.setDefaultValueList(Arrays.asList(1));
sph.setHidden(false);
sph.setIsRequired(true);
sph.setParamType(DesignChoiceConstants.SCALAR_PARAM_TYPE_MULTI_VALUE);
sph.setControlType(DesignChoiceConstants.PARAM_CONTROL_LIST_BOX );
sph.setValueType("static");
sph.setFixedOrder(true);
sph.setDistinct(true);
design.getParameters().add(sph); </pre>
</div>
<div>This works fine ... the parameter is added to the design. </div>
<div> </div>
<div>However, I can create a new SelectionChoice as follows, but how can I add it to sph's selection list? </div>
<div> </div>
<div>
<pre class="_prettyXprint">
SelectionChoice selectionChoice = StructureFactory.createSelectionChoice();
selectionChoice.setLabel("MyLabel");
selectionChoice.setValue("1");</pre>
</div>
<div> </div>
<div> </div>
<div>If I try to get the selection list as follows, the list is null, as expected, since it is currently empty:</div>
<div> </div>
<div>List list1 = spTest.getListProperty("selectionList");<br><br>
sph doesn't have a setListProperty(), and to call setPropety(selectionList, list1) I'd probably need to wrap list1 in a structure ... but I don't see what.</div>
<div> </div>
<div>If I copy a scalar parameter from a library which already has an item in the selectionlist, the list returned by getListProperty("selectionList") is not null, but adding further items to the list doesn't have any effect ... the parameter in the rptdesign isn't updated.</div>
<div> </div>
<div>Any ideas?</div>
<div> </div>
<div>Thanks!</div>
Find more posts tagged with
Comments
There are no comments yet