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

Question

Question

Pull each value in For-Each to use in naming convention

asked on October 16, 2015

I am using workflow to standardize our naming conventions. I pretty much have it down, except where I have multi-value fields. In my template I may have a certain document that pertains to two different programs, Excess Worker's Compensation and Primary Worker's Compensation. I have a lookup to find abbreviations for these, because I obviously don't want to use the full name in my file name. I have a for each value wrapped around my query, so that for each of the program values it will lookup the corresponding abbreviation.

 

However, I cannot figure out how to pull both of these instances into my naming convention. Here is a snippet.

 

I retrieve the programs, then for each value, I query the abbreviation. I have a program token and within the for each value, I append to the program token. I am trying to get this token to be _EWC_PWC

 

However, it is only pulling the first program.

These are the values retrieved by my retrieve values:

This is what my Program token ends up with:

But when I pull that into my rename function, I only get _EWC.

I'm not sure what I'm doing wrong here or how to pull both PWC and EWC into my naming. I feel like I am missing something very simple.

 

0 0

Answer

SELECTED ANSWER
replied on October 20, 2015

Any multi-value tokens used in single value fields will only use their first value. So when you used %(RetrieveFieldValues_program_All) in the query, you always got the first value, so the query ran was the same. Similarly, if you use %(Program Token) in the document name, you only get its first value.

If you want to use all values of a multi-value token in a single-value field, you need to "flatten" it by formatting it. In other words, Workflow doesn't know how you want the values combined into a single string.

So in Rename Entry, after you added the Program Token, you want to right-click it and select "Token Editor" from the menu. Then you should choose "All values separated by" and add the underscore as the separator.
 

3 0

Replies

replied on October 16, 2015

Can you add a screenshot of the properties for Query Program? It looks like you're using the wrong value in the query.

0 0
replied on October 20, 2015

I am using retrieve field values - Program_All from the multi-value token, and I am returning all rows.

0 0
replied on October 20, 2015

You want the token generated by For Each Value: %(ForEachValue_Current Value). Otherwise, you're always using the first field value.

0 0
replied on October 20, 2015 Show version history

Thank you, sorry, I should have seen that, or set this aside and come back to it. I changed the query to the current value.

 

However, when I track tokens, I get

_EWC

_PWC

but when I pull this token into my rename activity, I only end up with _EWC. How do I pull both of these into my rename?

File is named: CSAC EIA_EWC_Coverage_Documents_1415, there is no PWC in the file name and there needs to be. Is there a new line in the program token when I append values? Do I need to remove that?

 

Edit - I tried to remove the new line and it seems to work when I test, but I still only pull the first value into my rename activity.

0 0
SELECTED ANSWER
replied on October 20, 2015

Any multi-value tokens used in single value fields will only use their first value. So when you used %(RetrieveFieldValues_program_All) in the query, you always got the first value, so the query ran was the same. Similarly, if you use %(Program Token) in the document name, you only get its first value.

If you want to use all values of a multi-value token in a single-value field, you need to "flatten" it by formatting it. In other words, Workflow doesn't know how you want the values combined into a single string.

So in Rename Entry, after you added the Program Token, you want to right-click it and select "Token Editor" from the menu. Then you should choose "All values separated by" and add the underscore as the separator.
 

3 0
replied on October 20, 2015

Yes! Thank you! That was the piece that I was missing. I needed to specify the All values separated by _ in my token. Thank you, Miruna.

0 0
replied on October 16, 2015

Side question: is the abbreviation always made up using the first letter of each word in the field value?

0 0
replied on October 20, 2015

Unfortunately, no. We also have a Property program that is abbreviated Prop, Cyber = Cyber, not even abbreviated. There is no way to use a regular expression.

 

Also, I am using _abbrev so that I don't have two underscores or have to use conditional decisions to decide whether a field exists and if I need to put an underscore before I abbreviate that field.

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

Sign in to reply to this post.