Skip to main content
Nintex Community Menu Bar

Nintex removing leading 0 when using substring

  • November 10, 2017
  • 8 replies
  • 16 views

Forum|alt.badge.img+8

I have a value that is coming to me in the form of two digit number, semicolon, #, string of text. example being:

"03;#Red is a great color!"

I need to capture that two digit number. I was attempting subString(STRING,0,2) but if the STRING has a leading 0, it's being dropped and I wind up capturing "4;" instead of "04".

What's a good way around this?

8 replies

Forum|alt.badge.img+16

You could use parseLookup function:

Parse the value of a lookup control.
parseLookup([array or single lookup value], [optional bool showText])

parseLookup('33;#Red is a great color!', False) --- > returns 33

parseLookup('33;#Red is a great color!') --- > returns Red is a great color!


Forum|alt.badge.img+8
  • Author
  • November 13, 2017

Does that work for you? It still removes the leading zero for me.


Forum|alt.badge.img+16

oh to be fair I only tried with the example given!


Forum|alt.badge.img+8
  • Author
  • November 13, 2017

Alright.

Well, I can't bold the title, so I edited the post to better reflect the issue. 


Forum|alt.badge.img+8
  • Author
  • November 13, 2017

I realize now that I had the wrong idea of what value was being passed to me. I have a column titled "Number" in which I have the details with a leading 0; and I have a column titled "Reason" with text in it. The value being passed to Nintex via List Lookup control is "ID;#REASON. I thought it was passing "NUMBER;#REASON" and couldn't figure out why it was taking the leading 0 off for items like "03;#Red is a great color!" when in reality it, there was no leading 0 because the ID of Red is a great color is 3, not 03.

So, to get around this, I just deleted the original items, and added them back to the list. Now that my first item starts with "39" as the ID, everything fits correctly.

 

Just a misunderstanding of what information was being passed to me.


Forum|alt.badge.img+14
  • Scholar
  • November 14, 2017

once your item ID exceeds 99 you will run into the same problems again!

use parseLookup() function as advised by Cassy Freeman. that's what the function is designed for.


Forum|alt.badge.img+8
  • Author
  • November 14, 2017

It's a limited list that won't be added to.


Forum|alt.badge.img+14
  • Scholar
  • November 14, 2017

never say never happy.png

one will remove and re-add few items to the list, just like you did above, and you're in there