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

Question

Question

Fill group fields with first value

asked on August 2, 2019

I'm trying to make WF fill fields in group fields with the first value. What I have is 3 fields, Insurance type, Effective Date, and Expiration Date in a group. I want to take the dates from the first group and duplicate them to the empty fields.  Every time I try, What ends up happening is the 1st group gets blanked out and then 2-4 are correct. It's acting like a glitch. The workflow retrieves the field values and then clears everything out. Then I used "For each value" for the insurance type which would be 3 of them and then apply everything back. I also tried a count of the insurance type field to get 3 and then used "Repeat" to assign the values. Both ways get the same results. 

If anyone can get this working, let me know!

 

0 0

Answer

SELECTED ANSWER
replied on August 6, 2019

Hi Lucas,

If you want to remove the null value, I'd recommend applying the function "Remove Empty Items". However, if you remove the empty values, you won't know which values need to be updated. Instead, I handled this by performing the conditional logic inside the for each loop. While I'm iterating through the insurance types, I check whether the current Effective/Expiration date has been filled in with a logic calculation.

You could try performing this logic with the Token Calculator activity. Inside the For Each Loop, before updating the shell tokens, add a token calculator activity to evaluate the condition. The new workflow looks like this:

The logic in the Token Calculator (named Conditional IF Calculation) sounds like this:

IF the effective date at the current iteration is empty, replace the date with the first value of the effective date. IF not, leave the old value.

In Token Calculator language it looks like this: IF(%(RetrieveFieldValues_Test Effective Date_All#[%(ForEachValueInsurance_Iteration)]#)="", %(RetrieveFieldValues_Test Effective Date_All#[1]#), %(RetrieveFieldValues_Test Effective Date_All#[%(ForEachValueInsurance_Iteration)]#))

(Those are double quotes with commas between each token).

For the first Test Effective Date_All token, I have an index applied at the current iteration. (This gives me the value of the effective date at the current multivalue group I'm looking at.) The exact configuration looks like this:

The second token is what to replace the value with if it is blank. This is the first value in the effective date (at index of 1). The configuration looks like this:

The third token is the value to write if the effective date is NOT empty. I'm writing in the value that was there to begin with. This is the same as the Effective Date at the iteration.

Once you've performed the calculation, you'll want to update the shell token with the calculation.

You can add the expiration date (and any other tokens you want to iterate through in this manner) by adding a New Token to the Token Calculator activity and updating the Shell tokens with that calculation.

I hope this helps!

2 0

Replies

replied on August 5, 2019

Hi Lucas, 

I've got this to work by creating shell tokens to hold the values from the multi-value field group and using those shell tokens to update and replace the fields in the group. The workflow I created looks like this.

The important part is creating the shell tokens (be sure to check "allow tokens to have multiple values") and filling them with the correct values. I update the shell tokens with the values from the Retrieve Field Values activity at the correct index. If I'm understanding your use case correctly, the Insurance Type fields should already be on the document before the workflow runs. So I'm using the Insurance Type value to iterate the correct number of times in my For Each Value loop. I update the shell token for insurance type to the Insurance Type at the current value in the loop. The Expiration and Effective Date fields are filled with the value in the first group (which is the value at the index of 1). The below screenshot shows how to configure the Expiration Date from the Retrieve Field Values activity to give the first value in the token.

Once I've recreated the multi-value groups, I use Assign Field Values to replace the existing multi-value fields. 

This does not cover what to do for values that have been filled in. For instance, if Effective Date is not blank for Cargo. In that case, I would recommend doing some conditional expressions within the For Each Value loop to determine if the value should be kept or overwritten.

Hope this helps.

1 0
replied on August 6, 2019

Hello Nicole, This is exactly what I ended up doing. Thank you for your response. I eventually figured out that I needed to do the shell tokens. It works but now the issue is trying to make sure the WF doesn't do this if there are dates filled in. First thought would be a decision to compare the count of insurance types with the count of dates. So far, even when the dates are blank, the count function shows the same numbers. I have these fields configured as group fields which I'm not sure if the is messing with this. 

Here I count the values.

This is what the tokens look like.

Here are the results. it looks like it's counting a null value. I do not want that. 

Have you seen with group fields this issue before? 

 

0 0
SELECTED ANSWER
replied on August 6, 2019

Hi Lucas,

If you want to remove the null value, I'd recommend applying the function "Remove Empty Items". However, if you remove the empty values, you won't know which values need to be updated. Instead, I handled this by performing the conditional logic inside the for each loop. While I'm iterating through the insurance types, I check whether the current Effective/Expiration date has been filled in with a logic calculation.

You could try performing this logic with the Token Calculator activity. Inside the For Each Loop, before updating the shell tokens, add a token calculator activity to evaluate the condition. The new workflow looks like this:

The logic in the Token Calculator (named Conditional IF Calculation) sounds like this:

IF the effective date at the current iteration is empty, replace the date with the first value of the effective date. IF not, leave the old value.

In Token Calculator language it looks like this: IF(%(RetrieveFieldValues_Test Effective Date_All#[%(ForEachValueInsurance_Iteration)]#)="", %(RetrieveFieldValues_Test Effective Date_All#[1]#), %(RetrieveFieldValues_Test Effective Date_All#[%(ForEachValueInsurance_Iteration)]#))

(Those are double quotes with commas between each token).

For the first Test Effective Date_All token, I have an index applied at the current iteration. (This gives me the value of the effective date at the current multivalue group I'm looking at.) The exact configuration looks like this:

The second token is what to replace the value with if it is blank. This is the first value in the effective date (at index of 1). The configuration looks like this:

The third token is the value to write if the effective date is NOT empty. I'm writing in the value that was there to begin with. This is the same as the Effective Date at the iteration.

Once you've performed the calculation, you'll want to update the shell token with the calculation.

You can add the expiration date (and any other tokens you want to iterate through in this manner) by adding a New Token to the Token Calculator activity and updating the Shell tokens with that calculation.

I hope this helps!

2 0
replied on August 6, 2019

Thank you Nicole, I was able to figure this out also after some testing on my side. I went a little simpler. I just used the remove empty item function first then count on my date tokens. That gave me the right calculation so that my workflow would only fill in dates when there are more insurance types than dates. Thanks again. 

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

Sign in to reply to this post.