How to address substrings in sharepoint designer 2010

I'm using the action

extract substring from index of string.

the list values are like: 12;#Project Lunch

So I want to extract the text after the # sign, but designer won't let me just put a # in the "starting at"

 

thanks,jb

August 25th, 2010 7:14pm

You use a number for substring, so it will always extract the text "starting at" a specific # of characters.  Substring-after and Substring-before let you choose a character to reference.
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2010 7:17pm

I don't see Substring-before or after as an option in designer.

August 25th, 2010 8:10pm

Those are in InfoPath, but I don't remember all the options in SPD.  These are new as of 2010 and didn't exist in 2007.  Are there not several other substring commands?

Free Windows Admin Tool Kit Click here and download it now
August 25th, 2010 8:43pm

That looks like a Lookup field value! You don't have to parse them. When you create the workflow variable or use the field, you'll see a dropdown that says "Return field as". Instead of selecting the default (String), select Lookup Value (as Text) and the workflow will strip the 12;# off and give you Project Lunch.
  • Proposed as answer by Amol Khalipe Monday, October 01, 2012 9:14 AM
August 26th, 2010 1:07am

JB, if you have those options, then Doug's reply is exactly what you should do.  This is another huge improvement in SPD2010 with workflows whwere we can now choose the specific value we want to use for a given field.
Free Windows Admin Tool Kit Click here and download it now
August 26th, 2010 1:21am

Your correct it is a lookup, but I'm using the Ilovesharepoint lookup with picker http://ilovesharepoint.codeplex.com/releases/view/44989

For some reason it doesn't give me the option to return the field as a lookup value :(

I contacted the author of the project to see if there is anything he could do.

I don't want to go back to a drop down for that lookup. the picker works SO much better :)

August 26th, 2010 2:33pm

Is there a reason you're using a codeplex plugin instead of the built-in features?  I wouldn't expect a custom activity to have that full capability anyway, although they may figure it out over time.
Free Windows Admin Tool Kit Click here and download it now
August 26th, 2010 3:28pm

The built-in lookup column displays has a drop down box in the form. When you have 100+ items in the column a drop down box doesn't work very well (useability) the codeplex plugin uses the picker method so I can just type part of an item in the column and it will search an find all items containing what I typed.
August 26th, 2010 5:07pm

Did you ever find a solution to this? I am facing the same problem, also using the ilovesharepoint picker.

Thanks.

Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 12:04am

Ok, this thread is quite old, but I thought it might be worth putting down my solution for it in case somebody else searches for it. It's a little elaborate, but it seems to work:

Quick background: I have two document libraries with lookup columns, both looking up data in the same list. The lookup columns use the ilovesharepoint picker. If I ran a workflow on item in Library A, I wanted to find the corresponding item in Library B.

The first thing I needed were some custom actions that allow me to do some string manipulation. That way I could extract the ID part of the lookup field in Library A. I used SharePoint Designer Workflow String Actions http://spdwfstringactions.codeplex.com/discussions for it. I used those new actions in my workflow to grab the ID of the lookup field. So from "1234#;Something" I extracted the substring "1234" and stored it in a variable.

Now I knew the ID of the item in the lookup field of Library A. But I needed something to compare that ID with in Library B. Of course I cannot compare the ID with the content of a lookup field. So what I did next was use that new SharePoint 2010 functionality that allows you to display other columns alongside a lookup column. I want to Library B, into the list settings and configured the Lookup field to also bring along the ID column from the lookup list (let's call this the "Foreign ID").

Finally it was just a matter to compare my newly extracted number that I got from the lookup column in Library A with the Foreign ID column I had in Library B. If they matched then I knew the two lookup columns matched.

Hope this makes sense and helps other people to get it working. Might not be the prettiest solution but it works.

March 21st, 2011 3:26am

One way that I've been able to get a substring if I don't know the exact numbers of characters to begin the index is to use a calculated column.  It has a lot more features to extract substrings.  Then use the calculated column in your workflow.
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2011 5:08pm

I have a similar issue using the ILovesharePoint Filtered Look-up.

Can anyone tell me what the "1234" from the string "1234#;Something" is referring to. I have checked my lists and its not the ID of the item being looked up and it seems to have no relation to the current list.

I either need to be able to extract the "Something" or get a count up to the ";".

I do get just the "1234" if I set the variable AS Integer. I guess I could use a primary workflow to put that into another column then use a LEN to get the number of characters. Then in the other workflow use the LEN value in the Extract String from a specific number. But this seems like more work than it should be?

Any ideas?

November 9th, 2011 5:51pm

Here's a way to do it with the SharePoint Designer Workflow String Actions (see my post above for the link):

  • IndexOf(String): use this function to find the position of ";" in [your lookup column] and store it in variable posEndID
  • Substring(start,length): use this function to get the substring from "0" up to posEndID of [your lookup column], which gives you the ID, and store it in strID
  • Length(): use this function to figure out the length of "[strID]#;" and store it in lenID
  • Substring(start): use this function to get the substring starting from lenID in [your lookup column], which is everything after the #;

Yeah, four functions isn't great, but it seems to work.

Free Windows Admin Tool Kit Click here and download it now
January 5th, 2012 3:17am

Hi

yes

but you can write it by your self

Using SHP Designer got to code side of the page, locate the tag and in the xslt fill the substring-before to match your needs

It's the easier way

January 5th, 2012 1:06pm

Remeo, I think the author was referring to getting the substring in a workflow. What you are referring to is just a general aspx page, isn't it?
Free Windows Admin Tool Kit Click here and download it now
January 5th, 2012 9:22pm

That looks like a Lookup field value! You don't have to parse them. When you create the workflow variable or use the field, you'll see a dropdown that says "Return field as". Instead of selecting the default (String), select Lookup Value (as Text) and the workflow will strip the 12;# off and give you Project Lunch.

Doug,

thanks wery much, worked for me perfect!!

Thanks.

Karel

June 19th, 2012 7:56am

Thanks romeo, substring-before is the solution.
  • Edited by Peter_D503 Friday, October 19, 2012 3:56 AM
Free Windows Admin Tool Kit Click here and download it now
October 19th, 2012 3:56am

You cannot get indexOf out of the box, which makes this difficult. You can get solutions from CodePlex to allow this, if you have an on-premise installation with a SharePoint/governance team that will allow it.

Other option is to use a SP2013 and SP2010 workflow together or just use a SP2013 workflow. SP2013 workflows can do indexOf and other string operations that allow improved substring capabilities to 2010. If you need to use 2010 at the end of a workflow, or in parallel, then you can launch one from the SP2013 workflow.

September 12th, 2015 11:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics