Hi,Could someone help me understand the concept and solve my below problem?
I have a Two tables
1. VehicleTypesField Id category1 Cars2 Buses3 Trains
2nd table SubVehicleTypes
SubID Id SubCategory1 1 Sedan2 1 Suv3 2 Luxury4 2 Semi luxury5 3 Ac Trains6 3 Non Ac Trains
Requirements:1. Drop Down 1 will have data from Table 12. Drop Down 2 will have data from Table 2
When I select category from DD1 the second DD2 should give Subcategory based on ID(Common in both Tables).
ThanksFaisal
Discussion posts and replies are publicly visible
Hi Faisal,
The code below is just a reference for help you to implement your final solution. It is a working code, but the values in the locals are map instead queries. As Peter explained, you just need to replace the value in the local variables for your queries an use the selected vehicle id as a filter in the second query(subcategory).
a!localVariables( local!selectedVehicleId, local!vehicle: { a!map( id:1, value:"Cars" ), a!map( id:2, value: "Buses" ), a!map( id:3, value: "Trains" ) }, local!subCategory: { a!map( subTypeId:1, vehicleTypeId: 1, value: "Sedan" ), a!map( subTypeId:2, vehicleTypeId: 1, value: "Suv" ), a!map( subTypeId:3, vehicleTypeId: 2, value: "Luxury" ), a!map( subTypeId:4, vehicleTypeId: 2, value: "Semi Luxury" ), a!map(subTypeId:5, vehicleTypeId: 3, value: "Ac Trains" ), a!map( subTypeId:6, vehicleTypeId: 3, value: "Non Ac Trains" ), }, local!subType: if( isnull(local!selectedVehicleId), null, index(local!subCategory,wherecontains(local!selectedVehicleId,tointeger(local!subCategory.vehicleTypeId)),null) ), local!selectedSubType, { a!dropdownField( label: "Vehicle Type", labelPosition: "ABOVE", value: local!selectedVehicleId, placeholder: "Please select a vehicle", choiceLabels: local!vehicle.value, choiceValues: local!vehicle.id, saveInto: { a!save(local!selectedVehicleId,save!value), a!save(local!selectedSubType,null) } ), a!dropdownField( label: "Vehicle Sub Category", labelPosition: "ABOVE", value: local!selectedSubType, placeholder: "Please Vehicle Sub Category", choiceLabels: local!subType.value, choiceValues: local!subType.subTypeId, saveInto: { a!save(local!selectedSubType,save!value) } ) } )
Hope it help you to achieve your goal,
Cheers,
Acacio B.
Hi Acacio,
Thank you..I will follow what u and Peter have suggested.