cancel
Showing results for 
Search instead for 
Did you mean: 

Set key-value and display-value to dropdown control items.

In the case of an existing database where foreignkeys are used. It is required to be able to set the display-value the items of a dropdown-box so the ID is used to set the value of a field but the Description is used to display a user-friendly display-name.

 

i.e.:

Person-table {PersonID, PersonName, GenderID}

Gender-table {GenderID, GenderLabel}

 

The items property of the dropdown for Person.GenderID will be [Gender]

the value-property for Items will be GenderID, but I need a Display-value property to set the GenderLabel so the user does not see the Identifier, but he sees the GenderLabel

Status: New
Comments
bjornsublime
New Member

This feature is a must-have, I had to concat the name and id, and then parse the id in our rest API. I don't want to rely on matching strings basically.

tonykiefer
Resolver II

Hi Guys,

 

I have a solution with images.  If you have a dropdown of Key/Value pairs like so...

2.jpg 

You set the Items Property of the DD in this manner...

Table({Text:"",Val:Blank()},{Text: "CycleCount", Val:2},{Text: "Issue", Val:4},{Text: "Receipt", Val:3})

Note: the first possible selection is a Blank to allow a null entry.

The "Text" is visible to the enduser and the Val is on the back end.

3.jpg

 

 

To save the Val I use the patch.

 

Patch(ItemTracker_Transactions,Defaults(ItemTracker_Transactions),{ItemID:Value(ItemIDtxt.Text),TranTypeID:TransTypeDD.Selected.Val,FrLocID:FrLocDD.Selected.Val,ToLocID:ToLocDD.Selected.Val,ModifiedDate:Now()});

 

TranTypeID is the name of my SQL column.

TransTypeDD is the name of my dropdown.

.Selected is a property of the dropdown and Val is defined in the table I created above.

 

This method works...It's not as simple as SubmitForm(formname).  But if you are using a custom control the patch statement works.