Nintex removing leading 0 when using substring

  • 10 November 2017
  • 8 replies
  • 5 views

Badge +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

Badge +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!

Badge +8

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

Badge +16

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

Badge +8

Alright.

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

Badge +8

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.

Userlevel 5
Badge +14

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.

Badge +8

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

Userlevel 5
Badge +14

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

Reply