cancel
Showing results for 
Search instead for 
Did you mean: 

use of valueset

Former Member
0 Kudos

hi

how to use valuseset with dropdowns and can u explain use of value set.

thanks

kishore

Accepted Solutions (1)

Accepted Solutions (1)

piyush_kumar6
Active Contributor
0 Kudos

IWDAttributeInfo attinfo=wdContext.getNodeInfo().getAttribute("name of yr value attribute");

ISimpleTypeModifiable STTDFromCity=attinfo.getModifiableSimpleType();

IModifiableSimpleValueSet valuesetFCity=STTDFromCity.getSVServices().getModifiableSimpleValueSet();

STTDFromCity.setFieldLabel("City Code");

for(int k=0;k<wdContext.nodeItab_Loc().size();k++)

{

valuesetFCity.put(wdContext.nodeItab_Loc().getItab_LocElementAt(k).getLocid(),wdContext.nodeItab_Loc().getItab_LocElementAt(k).getName());

}

Answers (3)

Answers (3)

Former Member
0 Kudos

bhh

Former Member
0 Kudos

Hi,

Valueset is used when we want to convert a simple variable of

buiit in type(String) to simple type at Run time.

Say u have created a context ctx_String of string type and u

want to convert it into simpletype At runtime(This we generally

do when we are not sure of values that would come into

simpletype and will be decided at runtime.)

Use the following code .


IWDAttributeInfo attr_a_Schemas = wdContext.getContext().getRootNodeInfo().getAttribute("ctx_String");
ISimpleTypeModifiable isim_a_schemas = attr_a_Schemas.getModifiableSimpleType();
IModifiableSimpleValueSet isval_a_schemas = isim_a_schemas.getSVServices().getModifiableSimpleValueSet();
isval_a_schemas.clear();
for(int i = 0; i < someLength; i++)// some length equals to ur no of values that u would like to add to this simple type
{
  isval_a_schemas.put("KEY"+i,"DESCRIPTION");//here key and description can be replaces by ur value.
}

In order to use it in dropdown u can bind this context

ctx_string to dropdownbykey.

In order to get the selected value u can use


wdContext.currentContextElement().getCtx_String();

Regards

Surender Dahiya

Former Member
0 Kudos

Hi,

Following is the code


	  ISimpleTypeModifiable modifiable = wdContext.getNodeInfo().getAttribute("Your Attribute").getModifiableSimpleType();
	  modifiable.hasSVService()
	  ISimpleValueServices simpleValueServices = modifiable.getSVServices();
	  IModifiableSimpleValueSet simpleValueSet = simpleValueServices.getModifiableSimpleValueSet();
	  
	  for(int x=0; x<10;x++)
	  {
		  simpleValueSet.put(String.valueOf(x), String.valueOf(x));
	  }

This is needed only in case of Dropdownbykey.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi

thanks for u r reply ayyaparaj, can u please the use of value set and the code that was send by,sorry to trouble u

thanks

kishore