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

Question

Question

Best approach to using a workflow to get info from end of string

asked on November 2, 2022

I have to get the invoice number from the end of the %(ForEachEntry_CurrentEntry_Path) to mark an existing invoice document. We are working on separating this into easier to access variables, however, we need to validate and update all database entries in order to do so, i need to query using the filename (which I have) and the invoice ID (the bolded 6 digit number on the end of the string below) - this number varies in length from group to group.

\Corporation Counsel\Open\2019\0000 - 0099\2019-0015 - Internal Assignment DevGovCloud Testing for\Invoice - O'Malley & Thames - 987654

 

I am thinking of using a pattern matching process or the token calculator (split function?) but have had little luck so far. Any insight is appreciated.

0 0

Replies

replied on November 2, 2022

If that pattern is consistent, you should be able to use a Split function on the dash, then index from the end to get the last part (I also put Trim in to handle the empty space between the dashes).

2 0
replied on November 2, 2022

You can use pattern matching and indicate you want to match from the end of the string with $. Something like (\d+)$ would be the group of digits at the end of the string.

1 0
replied on November 2, 2022

That looks like what I need - total noob here - that the token calculator  widget right?

0 0
replied on November 2, 2022

The version I posted uses the Token Editor/Dialog. You can get to that by right-clicking on a token you've added somewhere, or through the > menu.

Miruna's approach uses the Pattern Matching activity, which may be easier.

0 0
replied on November 2, 2022

You can apply the same pattern matching in the token editor/dialog. The functions and indexing are not necessary if you're only after the number at the end.

1 0
replied on November 2, 2022

So this works, but i am still not able to get what i need for my query - here is the pattern match:

 

Here is my query

 

 

Due to my poor debugging skills (if only it was Visual Studio) I am outputting the failed look ups in an email -

So it seems that the pattern is working but when i consume the resulting token, i am not getting just the invoice. 

0 0
replied on November 2, 2022

Can you provide a screenshot of the workflow activities?

The pattern matching should work, so there has to be something else going on.

0 0
replied on November 2, 2022

 

its pretty basic at this point, but i only code in wf once in great while so i night miss something obvious

 

0 0
replied on November 3, 2022

Do you expect the query to return only one result?

How do you determine something failed?

It's not clear to me from these screenshots what tokens you're using in your email,

0 0
replied on November 3, 2022

My expectation is when I find an invoice doc, I strip out the invoice number, and query the database to look at the File Number and Invoice number. This should result in a single row returned or no rows.

i am using the 'invoice_number_in_pattern_match' in my query, and displaying it in the email (because i should be getting the correct results) but it seems that variable is resolving to the full statement.

I appreciate your assistance, but i have found we have over 5 distinct invoice patterns, so I am moving from this approach.

If you can tell me what seems off from my config screen shots and the output, that will further my general understanding. It looks like it should work.

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

Sign in to reply to this post.