Skip to main content
Known Participant
November 2, 2022
Question

Need to understand the Cascading of Drop down concept when data is from DB tables. with update functionality

Hi,
Could someone help me understand the concept and solve my below problem?

I have a Two tables

1. VehicleTypes
Field
Id   category
1    Cars
2    Buses
3   Trains

2nd table SubVehicleTypes

SubID Id SubCategory
1         1     Sedan
2         1     Suv
3         2     Luxury
4         2     Semi luxury
5         3     Ac Trains
6         3     Non Ac Trains


Requirements:
1. Drop Down 1 will have data from Table 1
2. Drop Down 2 will have data from Table 2

I want to display the selected field in 2nd dropdown with the list like

Actually i want this

2 replies

amans0009
Participating Frequently
November 2, 2022

a!localVariables(
  local!vehicle:{
    a!map(id:1,type:"car"),
    a!map(id:2,type:"Bus"),
  },
  local!subvehicle:{
    a!map(id:1,vehId:1,type:"ac-car"),
    a!map(id:2,vehId:1,type:"non-ac-car"),
    a!map(id:3,vehId:2,type:"ac-Bus"),
    a!map(id:4,vehId:2,type:"non-ac-Bus"),
  },
  local!selectedVehicleType,
  local!selectedSubvehicleType,
  {
  a!dropdownField(
    label: "Dropdown",
    labelPosition: "ABOVE",
    placeholder: "--- Select a Value ---",
    choiceLabels: local!vehicle.type,
    choiceValues: local!vehicle.id,
    value: local!selectedVehicleType,
    saveInto: {local!selectedVehicleType},
    searchDisplay: "AUTO",
    validations: {}
  ),
    a!multipleDropdownField(
      label: "Multiple Dropdown",
      labelPosition: "ABOVE",
      choiceLabels:index(local!subvehicle.type,wherecontains(tointeger(local!selectedVehicleType),tointeger(local!subvehicle.vehId)),{}),
      choiceValues:index(local!subvehicle.id,wherecontains(tointeger(local!selectedVehicleType),tointeger(local!subvehicle.vehId)),{}),
      saveInto: {local!selectedSubvehicleType},
      value: local!selectedSubvehicleType,
      searchDisplay: "AUTO",
      validations: {}
    )
}
)

Known Participant
November 2, 2022

Thank you Aman