Best practice forum (Archived)

Customfield_[shortname] upload when multiselct is used

 
Nathan Lewis
Re: Customfield_[shortname] upload when multiselct is used
par Nathan Lewis, Monday 27 April 2015, 15:46
Groupe Totara

Hi Peter.

From a quick look at the data that's stored when you use a multi select through the interface, I think it's going to be quite difficult. As far as I'm aware, there's no special code to handle parsing multi select custom field data during upload (but I didn't look thoroughly).

You could try formatting your data like this:

{"47bce5c74f589f4867dbd57e9ca9f808":{"option":"aaa","icon":"","default":1,"delete":0},
"9df62e693988eb4e1e1444ece0578579":{"option":"ccc","icon":"","default":1,"delete":0}}

where "aaa" and "ccc" are the two options you want, the value in "icon":"" needs to contain the icon for that option (you can see these in the course_info_field table), and the hex strings are from the course_info_data_param table, but you won't see them there until you've selected those options for a course using the interface (e.g. create a course, select all multi select options, check the db table, the hex strings are in the order that the options are listed in the multi select).

Obviously this is too complicated for everyday use, but you might be able to do it if you need a one-off upload. Unless I'm mistaken and someone else can suggest a better solution, I suggest you post in the suggested features forum and ask for the upload tool to be improved.

Nathan