This might be simple, or impossible. I want to display in a drop down the following, but in the database store a number representing each, as opposed to the words in the drop down. I want to do this to assist a calculation.
Drop down display - store in DB
Week - store value 52
Fortnight - store value 26
Month - store value 12
Quarter - store value 4
Year - store value 1
Hi there, @neilgellett⌠I would use an option set to do what you have described, and I would configure the set with the display of each option being Week, Fortnight, Month, Quarter, and Year. Then, I would add an attribute (with a type of number) to the set, and I would hold the numeric value for each option in the attribute.
Got a follow on one for you, I have added an edit button into the Repeating group which when clicked shows a pop up. The pop up has all the fields in the table including the frequency (stored as 1, 4, 12, 26 & 52). Auto-binding is enabled on the field. Iâve used your method to generate a dynamic list for when users want to update, they can use same method. Question 1, I canât bind to the field I need to âfrequencyâ, it doesnât show any more?
The question is, because the data in the field reads 4 (in this case quarterly) is there a way to display âquarterlyâ in the âplaceholderâ field as opposed to the stored field of 4 (so on and so forth)?
Hi, Neil⌠Iâm not sure about the auto-binding question⌠I would probably need to poke around under the hood a bit to see whatâs going on there.
About the second question, if you are only saving the optionâs attribute in the database and not the option itself, you could do something like the following to get to the option from the attribute (in this example, I am storing the attribute in a field called frequency numeric on the User data type).
You might also want to save the option itself to a field in the database so you have âeasyâ access to it without having to âback into itâ via its attribute. Now that I think about it, if you save the actual options, you would still have access to their attributes, so you might not need the number field to store the attributes. So, anyway, I think youâve got some options here.