Question

I need guidance in how I create a dropdown in a SharePoint List where the user can select which Period they’d like to enter a dollar value and then have a second field that allows them to enter the related Value Amount for the period.

Screenshot below: How can I relate the Value Amount field for each specific Period in the drop down? enter image description here

I appreciate any help you can provide. Thank you!

Was it helpful?

Solution

Without some complicated customized coding, I don't think you can achieve what you want.

The way SharePoint lists are designed, they are meant to store one value per field on each list item. (With some exceptions, such as multi-select choice fields, or user fields that allow multiple users.) But in general, the expectation is that for a single list item, it is going to have only one value per field.

So if your fields are Period, which is a Choice field (represented by the drop-down control), and the Value Amount (which looks to be either a text field or a number field?), SharePoint expects only one value for each of those. Your first option is to have users enter one list item per Period. They create a new item, select the Period, then enter the Value Amount for that Period, then save it. Then they would need to create another list item for the next Period. The form for that would look something like your screenshot, and the list view would look something like this:

screenshot of list view

If you also needed to track these entries by an entity, say by Project or by Department, you could also have another Choice field (for Project or Department) that the user would populate while making their entry. This would mean each Project or Department would have multiple list items, one per Period.

If you need to have all the Value Amounts on one single list item, the way to do it would be to create multiple Value Amount fields, one per Period, and do away with the Period drop-down. The form for that would look something like:

screenshot of new form

And the list view would look something like:

enter image description here

Again, if you needed to differentiate by an entity like Project or Department, you could add a drop-down for that, but this time each entity would have only one list item, since all the Periods would be represented on one list item.

That all being said, as I mentioned in the beginning, what you want could possibly be achieved through a custom form and some custom coding. To do it, what I personally would do (because there is usually more than one way), is set up a list with individual Value Amount fields for each period, as in my second example, and then in my code, read the field names, parse off the dates, construct a drop-down using those dates, and as the user changed the drop-down, the code would reach back to the list item and get or set the value of the individual fields based on the value in the form's Value Amount text box by matching the beginning part of the field name to the date selected in the drop-down. It would give the illusion of the functionality you want, but really in the background, the data would be stored as in my second example.

OTHER TIPS

You could create a calculated column to store related Value Amount. Use following formula in the calculated.

=IF(Period="12/31/2019","500","")
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top