locked
How to extract substring from Multi Line Text field? RRS feed

  • Question

  • I have a Multi Line Text field with a bunch of HTML text (it stores the Response data from a HTTP Request) - this field is called "ResponseString". Within ResponseString, there is a snippet of text that I want to extract from within my existing SharePoint Designer Workflow but I am unsure on how to create a substring when the text I want is not always in the same spot (I can't use the default substring actions in SharePoint Designer Workflow since they require me to specify a # of characters).

    For example - ResponseString contains the following and I want to extract only the bold text below:

    <HTML>
    <HEAD></HEAD>
    <BODY>
    <DIV1>Blah</DIV1>
    <DIV2>Blah</DIV2>
    <DIV3>Text I need</DIV3>
    </BODY>
    </HTML>

    I am using SharePoint 2010 and have I Love SharePoint Custom Workflow Actions installed as well

    Clarification - The text I need is ALWAYS in DIV3 but DIV3 is not always in the same spot in the HTML.  I'm trying to figure out how I can search for DIV3 and extract the text within that tag, all form within my SharePoint Designer workflow
    Monday, August 18, 2014 8:16 PM

Answers

  • Hi Sephiroth,

    According to your description, my understanding is that you want to extract substring from Multiple line of text field in SharePoint.

    With SharePoint 2010 workflow, we cannot extract the substring from the multiple line of text field when the spot is not fixed.

    I recommend to use calculated column to extract the substring.

    Create a new field in Single line of text type in the list, and then edit the list form in InfoPath. Set the default value of the Single line of text to equal the value of Multiple line of text field.

    And we also need to set two characters at the beginning and the end of the needed text in the Multiple line of text field, such as: BlahBlah#Text needed#BlahBlah.

    Then we can create the calculated column to extract the text from the Single line of text field with the formula below(Text is the name of the Single line of text column):

    =LEFT(RIGHT([Text],LEN([Text])-FIND("#",[Text])),FIND("#",RIGHT([Text],LEN(Text)-FIND("#",[Text])))-1)

    You can also use code to extract the text you need from Multiple line of text field.

    Thanks,

    Victoria

    Forum Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Victoria Xia
    TechNet Community Support


    • Edited by Victoria Xia Friday, August 22, 2014 7:33 AM
    • Marked as answer by JasonGuo Sunday, August 31, 2014 1:46 PM
    Friday, August 22, 2014 7:32 AM

All replies

  • Try using the following solution from codeplex, hope it helps

    http://spdwfstringactions.codeplex.com/


    Cheers,

    Tuesday, August 19, 2014 4:51 AM
  • Hi Sephiroth,

    According to your description, my understanding is that you want to extract substring from Multiple line of text field in SharePoint.

    With SharePoint 2010 workflow, we cannot extract the substring from the multiple line of text field when the spot is not fixed.

    I recommend to use calculated column to extract the substring.

    Create a new field in Single line of text type in the list, and then edit the list form in InfoPath. Set the default value of the Single line of text to equal the value of Multiple line of text field.

    And we also need to set two characters at the beginning and the end of the needed text in the Multiple line of text field, such as: BlahBlah#Text needed#BlahBlah.

    Then we can create the calculated column to extract the text from the Single line of text field with the formula below(Text is the name of the Single line of text column):

    =LEFT(RIGHT([Text],LEN([Text])-FIND("#",[Text])),FIND("#",RIGHT([Text],LEN(Text)-FIND("#",[Text])))-1)

    You can also use code to extract the text you need from Multiple line of text field.

    Thanks,

    Victoria

    Forum Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Victoria Xia
    TechNet Community Support


    • Edited by Victoria Xia Friday, August 22, 2014 7:33 AM
    • Marked as answer by JasonGuo Sunday, August 31, 2014 1:46 PM
    Friday, August 22, 2014 7:32 AM