cancel
Showing results for 
Search instead for 
Did you mean: 

How to code dependant dropdowns

Former Member
0 Kudos

Hi

From Function modules i have the following structure which i have mapped to my context:

Building(Node)

|_Build

|_Btext

Room(Node)

|_Build

|_RNr

|_Rtext

In my View I have 2 dropdowns - Building and Room. The Room dropdown values are dependant on the Building value.

I am using Dropdown by key. How do I code the second dropdown so that it populates where

Building.Build == Room.Build?

Below is my code for the 2 dropdowns. Your help is much appreciated and points rewarded.

//SRM-BUILD
IWDAttributeInfo ainfoBuild =wdContext.nodeZhr_Rfc_Dataver_Input().nodeOutputGetData().nodeIt_Outtab().getNodeInfo().getAttribute("Btext");
ISimpleTypeModifiable stBuild = ainfoBuild.getModifiableSimpleType();
IModifiableSimpleValueSet vsBuild =stBuild.getSVServices().getModifiableSimpleValueSet();
for(int i=0;i<wdContext.nodeBuild().size();i++){
     wdContext.nodeBuild().setLeadSelection(i);
     vsBuild.put(wdContext.currentBuildElement().getBuild(),wdContext.currentBuildElement().getStext());
}
	  
   if(wdContext.currentBuildElement().getBuild() != null){
   IWDAttributeInfo ainfoLocation =wdContext.nodeZhr_Rfc_Dataver_Input().nodeOutputGetData().nodeIt_Outtab().getNodeInfo().getAttribute("Rtext");
   ISimpleTypeModifiable stLocation = ainfoLocation.getModifiableSimpleType();
   IModifiableSimpleValueSet vsLocation =stLocation.getSVServices().getModifiableSimpleValueSet();
        if(wdContext.currentBuildElement().getBuild().equals(wdContext.currentLocationElement().getBuild())){
		   for(int i=0;i<wdContext.nodeLocation().size();i++){
			   wdContext.nodeLocation().setLeadSelection(i);
			   if(wdContext.currentBuildElement().getBuild().equals (wdContext.currentLocationElement().getBuild())){
				   vsLocation.put(wdContext.currentLocationElement().getLoc(),wdContext.currentLocationElement().getStext());
			   }
		   } 
	   }
   }

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for all the help.

I will go RFC route(send parameter to RFC and retrieve values based on parameter)

Former Member
0 Kudos

Hi,

In the First Dropdown(Building) , in the Onselect event you can write the code to populate the second dropdown(Room). The logic here will be to find the Building selected by the user and based on that , enable and populate the second dropdown of Room.

refer the following thread which is similar to your query.

Dependable Dropdown boxes

Thanks

Abhilasha

PradeepBondla
Active Contributor
0 Kudos

Hi,

Its been discussed many times in this forum...

you just need to pass the Building parameter to room Functional module.

wdcontext.roomnode.setroomattribute(wdcontext.buildingNode.getcurrentBuildingParameter());

and populate the drop down with the output of room functional module

PradeeP