Skip to main content
Nintex Community Menu Bar

Nintex removing leading 0 when using substring

  • Nov 10, 2017 4:07 PM UTC
  • 8 replies
  • 24 views
  • Translate All

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!

Translate

Forum|alt.badge.img+8
  • Author
  • Nov 13, 2017 1:55 PM UTC

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

Translate

Forum|alt.badge.img+16

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

Translate

Forum|alt.badge.img+8
  • Author
  • Nov 13, 2017 2:18 PM UTC

Alright.

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

Translate

Forum|alt.badge.img+8
  • Author
  • Nov 13, 2017 3:06 PM UTC

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.

Translate

Forum|alt.badge.img+14
  • Scholar
  • Nov 14, 2017 1:50 PM UTC

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.

Translate

Forum|alt.badge.img+8
  • Author
  • Nov 14, 2017 1:53 PM UTC

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

Translate

Forum|alt.badge.img+14
  • Scholar
  • Nov 14, 2017 2:00 PM UTC

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

Translate