Forum Academy Marketplace Showcase Pricing Features

Drop down - F, W, M, Q, A

Hi,

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

Is this possible?

Thanks

Neil

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.

Options:

Attribute example:

Set up the dropdown like this:

option-set3

Finally, when you save the dropdown selection to the database, save the option’s attribute into a number field, and you’re all set.

Hope this helps.

Best…
Mike

Hi Mike,

Awesome, works perfect. And thanks for introducing me to option sets - I will be using them a lot!

Cheers

Neil

1 Like

Hi Mike,

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)?

Cheers & thanks

Neil

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. :wink: