CRITFC / Helpdesk

Parent repository for tribal CDMS documentation and issues
1 stars 0 forks source link

Multi-select fields not storing values #20

Closed cwatry closed 4 years ago

cwatry commented 4 years ago

Just as title states. We created a multi-select field in the header of a dataset, with data type = string and control type = multi-select; however, regardless of whether a single or multiple values are selected, no values are stored in the SQL table when the record is saved. All values are instead NULL for this field after saving. Am I missing a step to set this up properly or doing something else wrong for this to not work? Any guidance on how to make a multi-select field function would be appreciated, thx.

nowinski commented 4 years ago

Just tested the multi-select control in CRITFC CDMS and it works. Both values are saved to SQL table. Should have tested that before asking you to add this to the issue forum. I'll work with you to resolve this on NPT CDMS.

kenburcham commented 4 years ago

The necessary things are: 1) field in the c# class (string) 2) column in the table (varchar, etc) 3) field added to Field table (linked to the datastore) with ControlType ="multiselect" and PossibleValues set as a json array. 4) datasetfield added to DatasetField table (linked to dataset) that is multiselect 5) everything spelled the same... :) <-- this has bit me before

You can troubleshoot using the network tab on the browser dev tools to see what is being posted... when saving it should be a json array of selected values for the column. Then when viewing a record, the network tab will also show you the data sent back and it should also be a json array of the values that are stored...

hope that is helpful information.

nowinski commented 4 years ago

Traced to DbColumnName spelling in Fields table. This one gets me regularly! After correcting this, remember to remove/add column from DatasetFields table (via UI) to push changes to dataset level.