You are viewing limited content. For full access, please sign in.

Question

Question

Evaluate the first 3 string characters in a token [Forms] [Workflow]

asked on January 6, 2015

On my form, we have split up 1 drop down selection into 2 options.  I tried having the form assigning both options the same value of IND, but Forms will initially accept.  However, after submitting once and going back to the field, the second selection value is updated to IND_1

On the PDF I am filling out, I am now looking to only evaluate the first 3 characters of the value in order to correctly fill out the PDF.

How would I accomplish this?  I don't see a function within the token dialogue.

0 0

Answer

SELECTED ANSWER
replied on January 6, 2015

You can use the token editor to apply a regular expression that will get the first three characters. Your token would resemble

%(RetrieveLaserficheFormsContent_Some_Value#<\w{3}>#)

2 0

Replies

replied on October 31, 2017

Hi Alexander, I know this is an old post. I tried your solution and it works for retrieving first characters. I then tried retrieving the last 3 characters, but can't make it work. 

I tried:

%(RetrieveLaserficheFormsContent_Some_Value#<\w{0, -3}>#) 

And

%(RetrieveLaserficheFormsContent_Some_Value#<\w{-3}>#)

 

What would be the correct way to do that? I'm trying to check that the last part of an entry be "1234" so I thought extracting the last part and check it would be a good way.

I'm already checking with a Rule Condition "On Entry" that the file be an xml and that it contains 1234. But now I want to make sure that 1234 is at the end; which was not able to figure out with the Rule Condition so now I want to double-check if one slipped; but if there is actually a way to check this with the condition, that would be even better. 

 

Thank you,

Raul Gonzalez

0 0
replied on November 1, 2017

Regular expression does not use negative numbers to indicate a change in direction when looking up values in strings. However, you can indicate you want to look for the last 3 digits before the end of the string by adding a "$" (which marks the end of the string):

%(RetrieveLaserficheFormsContent_Some_Value#<\w{3}$>#)

1 0
replied on November 1, 2017

Thanks Miruna, for some reason I was thinking of substr. That makes a lot of sense now.

0 0
replied on October 31, 2017

Sorry, I hadn't realized that there is a condition for "Ends With" right on the Rule Condition. Your response is a good reference though.

 

Thank you,

Raul Gonzalz

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.