Split Multiselect Values

From SMTX Wiki
Jump to navigation Jump to search

Cae : we have a multiselect field (checkbox) and we need each individual value (to call a subform). So how to move from the piped values into seperate values (each value in a seperate field)?

we will use substring :)

example:

checkboxes contain a list of IDs (!!always 3 digits!!), and in a second column the name of the subform.

suppose they select 187||203||567

to extract the first value ('187')

    SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 0,3)
    '0' indicates the starting position, '3' indicates the number of characters we need to pull out

the second value would then be found via:

    SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 5,3)
    we start at position 5, because of the first 3 characters and then the 2 pipes


for the following elements:

  SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 10,3)
  SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 15,3)
  SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 20,3)
  SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 25,3)
  SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 30,3)
  SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 35,3)
  SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 40,3)
  SubString('#REPLACE-FORMFIELD-Bart approval test||Subforms||Nr#', 45,3)

sample form: http://dev.ssp7.smt-x.com/Forms/Admin/formDetail.aspx?tab=1&id=81&ActiveFieldId=8175