Sugarcrm 7 Multi-select keys display wrong characters in database

Hello fellow sugarers !

I have a big weird issue with multiple choice dropdowns, the keys in the database are encapsulated within "^" characters

In admin, via the Studio, i create a new Multi choice Dropdown field under Accounts module, called list_test_c

Here are the key and the values i've set :

KeysValues
choiceoneChoice One
choicetwoChoice Two
choicethreeChoice Three
choicefourChoice Four

Every thing is well displayed under studio.

So, this is well displayed under the account's record view, and i can select one or more choices for list_test_c.

For Record n°1, i've selected Choice One and Choice Two, so in my database, under accounts_cstm's field list_test_c, i assume i will see choiceone,choicetwo.

And for Record n°2, because i've selected only Choice Three, in my database, i will certainly see choicethree.

won't i ?

But Sugar decided not to do that. So in my database i have :

Record n° 1 => ^choiceone^,^choicetwo^

Record n°2 => ^choicethree^

Yes, the "^" caracter is added at the beginning and ending of each key.

Is that even normal ? It does that only for multi select fields, but not for normal dropdowns.

Do you have any clue on that matter ?

Thanks a lot.

Gaëlle

Parents
  • Hi Gaelle Fernandez

    This is normal behaviour so it fits within one single database field. You can decode this string by using `unencodeMultienum` which will give you an array of values you have saved to the database. And yes, it only does it for multienum fields and not just your normal enum field

  • Hello

    Thanks a lot, i've seen unencodeMultienum pass in my researches after i've posted this thread.

    But i still have a really strange behaviour :

    My client imports the datas via the import wizard. I've checked their .csv file,formatted with quotes, and has come as separator.

    in the csv, the data "list_test" is empty, but in the database, the field list_set_c on accounts_cstm is set to "^^"

    i've tested to add a new record via sugar, and did not set list_test_c field : in database, the field is really empty.

    And i have a real problem, because i have a date field which is dependant and calculated based on "if list_test_c is set, fill date_field_c to Today".

    And because with the import wizard, the list_test_c field is set to "^^", my date_field_c is filled with today.

    i don't know if i am explaining it right, but please if you need more information to help me, i'll be glad to give them to you.

Reply
  • Hello

    Thanks a lot, i've seen unencodeMultienum pass in my researches after i've posted this thread.

    But i still have a really strange behaviour :

    My client imports the datas via the import wizard. I've checked their .csv file,formatted with quotes, and has come as separator.

    in the csv, the data "list_test" is empty, but in the database, the field list_set_c on accounts_cstm is set to "^^"

    i've tested to add a new record via sugar, and did not set list_test_c field : in database, the field is really empty.

    And i have a real problem, because i have a date field which is dependant and calculated based on "if list_test_c is set, fill date_field_c to Today".

    And because with the import wizard, the list_test_c field is set to "^^", my date_field_c is filled with today.

    i don't know if i am explaining it right, but please if you need more information to help me, i'll be glad to give them to you.

Children