Skip to main content
June 24, 2021
Question

Have questions on Drop Downs

  • June 24, 2021
  • 4 replies
  • 0 views

Hi All,

I have one Dynamic Drop down.

Now I wan to use this collect an information for purchasing.

In my code I am capturing Ids (as value and savinto).

But while writing to DB along with other vehicle details In I want the entry of choice label text for saving the form in DB.

Could you please suggest how can I do?

My Codes are here: and It is working:::

a!localVariables(
local!vehicleTypeData:rule!FF_Exp_VehiclesTypes(VehicleId:null),
/*local!vehicleSubTypeData:rule!FF_Exp_VehiclesSubTypes(typeId:null),*/
local!type,
local!subType,
local!saveSubType,
{
a!dropdownField(
label: "Dropdown",
labelPosition: "ABOVE",
placeholder: "--- Select a Value ---",
choiceLabels: index(local!vehicleTypeData,"category",null),
choiceValues: index(local!vehicleTypeData,"id",null),
value:local!type,
saveInto: {local!type,a!save(local!subType,
rule!FF_Exp_VehiclesSubTypes(typeId: save!value).data)},
searchDisplay: "AUTO",
validations: {}
),
a!dropdownField(
label: "Dropdown",
labelPosition: "ABOVE",
placeholder: "--- Select a Value ---",
choiceLabels: index(local!subType,"subcategory",{}),
choiceValues: index(local!subType,"subid",{}),
saveInto: local!saveSubType,
value: local!saveSubType,
searchDisplay: "AUTO",
validations: {},
disabled: isnull(local!type)
)
})

    4 replies

    mikes0011
    Brainy
    June 24, 2021

    Can you clarify what you're still wanting to do with this?  The code you posted looks like it would work (though I'd suggest moving the query for subType into the local variable based on what the current type selection is).

    The Expression Guru
    June 24, 2021

    For a Vehicle form.. I need to capture the name of the Type and Subtype of the vehicle and write to DB. I want to use  this DD and capture the name as mentioned in Choice labels.

    Lets say: Choice Labels are "BUS", "TRAINS","CAR" and Choice values are 1,2,3 as ids....But in my DD I am saving Idss. So how I can save for a form on selection BUS or Train or Car?

    mikes0011
    Brainy
    June 24, 2021

    Why not just use the ID value you have captured already as a result of the original dropdown?  You can make a query entity call that queries directly on a single ID and returns only the "category" or "subcategory" fields (whichever you need), which would execute very quickly.

    The Expression Guru