Skip to main content

Hi All,

I have 3 textboxes in new form for which I save the data in one SharePoint list field.

eg. Textbox1 contains say value T1, Textbox2 contains T2 and Textbox3 contains T3, then I save the data as T1;T2;T3 in my list field.

 

Now, I need to segregate the data in Display/Edit forms based on semicolon acting as separator.

 

I have applied expressions for all 3. These expressions work fine when I provide value for all 3 but tend to fail in case I provide T1 as blank.(PFA)

 

Please let me know in case this functionality can be achieved directly(although no split function available in Designer's operators) or some modification in my expressions might do the trick.

 

Thanks in advance,

Kamal


11928iAE1EC392FDD80C27.png
16308iF92E729443FD845F.png
12487i5486670D812105B6.png
13805i378C6E29C8187794.png
13700iCEE182FDA5E2F0E6.png
12571i1C9AD612313ECF8E.png

Hi Kamal

You are correct in saying that there is no out of the box split method as there is no operator that can determine where to split text based on a certain string, this can however be build by using some expressions however the expression building would be somewhat complicated.


 


Based on the scenraio you have layed out and assuming that you will always just return three values. There are some alteration you would need to make to the saved data as well as your current expressions in order to split the content contained in the string values especially when one of the values had been removed.


 


Please see the below steps:


1) You would need to ensure that when your values are saved that they end in a semicolon as well, as the expressions will find the semicolons and split the values based on that, therefore the save value should look like this: T1;T2;T3;  


 


Something to note:



  • If there are some spaces added between the the semicolon and the next value then the expression might not behave as expected therefore you need to also ensure that there are no spaces added to the saved value.

  • This solution will also cater for if there are less that three values provided. I you however change the value yourself for testing purposes then you would need to remove the semicolon that goes with that value as well Example: the value being retuned fromt he SmartObejct is "T1;T2;T3;" if you wanted to change the value to see if is still displayes the correct result after let say T1; had been removed then you would need to remove the semicolon that goes with T1;


 


2) You can then configure the following expressions:



Explanation of the controls used in the expressions (Avoid Expression building confusion):



  • R1(TB) - This is a textbox and contains the entire string that had been saved (this is the data that we will be splitting).

  • When a replace is done in the above expressions the "Empty Sting" operator is used as the replacing value.



 


3) After you have configured the above expressions You can then bind them in the following order.


Datalabel 1 = Find T1


Datalabel 2 = Find T2


Datalabel 3 = Find T3



 


At this stage your expressions will already have split the value from the control R1(TB) however the values will still have the semicolon appended to it, therefore we need to remove it before displaying the final result in the text boxes.



 


4) To remove the semicolons from the splitted values now displayed in datalabels, you should bind the "Remove Semicolon" expressions to the text boxes as per below:


Text Box 1 = Remove Semicolon T1
Text Box 2 = Remove Semicolon T2


Text Box 3 = Remove Semicolon T3



5) After the above had been done your result would look like the below image. When you remove the first value from the R1 (TB) control which contains the initail value the expressions will execute again and returnt he correct results.



Additional image displaying the affects when the given value contains less than three values or if you altered the value to only contain two or less values.



 


 


Note: Should you feel that this post is of use and or an accurate solution to the raised question, I kindly encourage you to mark it as such using the 'Mark as Solution', 'Kudo' andor ‘Me Too’ options.


 


Kind Regards


Raymond


 


Good Day @Kamal


 


I created a KB articles regarding this issue and the solutions, should someone else run into the same issue they would have exact steps to follow in order to get the underlining issue resolved.


 


The KB Article can be accessed from here:


 


https://help.k2.com/products/kbs100092?lang=en


 


Note: Should you feel that this post is of use and or an accurate solution to the raised question, I kindly encourage you to mark it as such using the 'Mark as Solution', 'Kudo' andor ‘Me Too’ options.


 


Kind Regards


Raymond


Reply