cancel
Showing results for 
Search instead for 
Did you mean: 
clong
Nintex Newbie

Turn ID into a 3 character string / Get the last 3 characters of a string / TRUNCATE

I'm trying to get the ID of an item and make it a three digit number string.

 

I have tried multiple solutions. My most recent is this inside setting a variable

fn-Substring(fn-PadLeft(2,{WorkflowVariableSmiley Surprisedid},00),fn-Length(fn-PadLeft(2,{WorkflowVariableSmiley Surprisedid},00))-3,3)

 

If Oid = 11 I would expect the result to be 011

The log says Oid: 11 and varOrderID:

I have also tried using a calculated field on the list that has a 3 digit number like I want and use the Query a List action to retrieve the calculated field but that also returns with no result.

Labels: (1)
0 Kudos
Reply
5 Replies
Automation Master
Automation Master

Re: Turn ID into a 3 character string / Get the last 3 characters of a string / TRUNCATE

first of all, check the correct syntax for single inline functions.

eg. PadLeft's first argument should have been source string ...

https://help.nintex.com/en-US/nintex2013/help/#Workflow/RootCategory/Designer/Nintex.Workflow.Inline...

 

 

at second, I think regular exprassion would be much easier for this task.

try following

i.jpg

 

regular expression pattern:

 

.{3}$

 

 

0 Kudos
Reply
clong
Nintex Newbie

Re: Turn ID into a 3 character string / Get the last 3 characters of a string / TRUNCATE

Almost solves it but it adds a semicolon to the end
0 Kudos
Reply
Automation Master
Automation Master

Re: Turn ID into a 3 character string / Get the last 3 characters of a string / TRUNCATE

"it" doesn't return any semicolon... => can you see it in RunNow output?

 

RE's extract operation always returns a collection. and it has to be aproached that way.

if you approach it differently, eg. as a single line text value, you might see semicolon(s) there, which is collection elements separator

 

0 Kudos
Reply
Stonehage
Nintex Newbie

Re: Turn ID into a 3 character string / Get the last 3 characters of a string / TRUNCATE

Hi I do this to get my 0000025 ID text number...

Build String Action...

fn-Substring(0000000{ItemProperty:ID},fn-Length({ItemProperty:ID}),7)

Adjust the number of Zeros and Length as required.

0 Kudos
Reply
Automation Master
Automation Master

Re: Turn ID into a 3 character string / Get the last 3 characters of a string / TRUNCATE

2nd parameter of fn-Substring() defines a position where it should start copy from.

so if your ID is 11, it's length is 2, so you get substring copied starting from 2nd position...

 

I'm affraid, you will not achieve what you want with fn-Substring(), unitl you calculate correct start position in a compplicated way.

use a regular expression approach as suggested, that's much easier.

0 Kudos
Reply