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

Question

Question

Track token iterations

asked on September 15, 2015 Show version history

How can I track iterations of tokens in a workflow that uses a for each activity?

 

I am trying to use the track tokens activity to record the results of a database lookup.  The lookup occurs once for each instance of an ID.  The track tokens activity works, but only for a single ID.  I have tried placing the track tokens activity within the for each activity right after the lookup.  I have tried placing it at the end of the workflow.  I have tried placing two track token activities, one in both places, but the results are the same.  I only see one set of tokens associated with a single ID.  How can I view the database lookup results for each ID that a workflow instance processed?

0 0

Answer

SELECTED ANSWER
replied on September 16, 2015

That actually looks like your server defaults have been modified to not record token data. Look in the WF Admin Console under Server Configuration\Advanced Server Options on the Workflow tab. The Default options would apply to any new workflow. Pick your workflow name from the list and make sure that "Tokens" is checked under "Track the following messages".

1 0

Replies

replied on September 15, 2015

Chris - You can create a multi-valued token called LookupIDs before your For Each activity and then within the For Each just modify that token by appending the appropriate lookup ID value for each iteration.  At the end of you workflow you can then use the Track Tokens activity to see all of the ID's that were added to the LookupIDs multi-value token.

1 0
replied on September 15, 2015 Show version history

Some screen shots;

0 0
replied on September 15, 2015

Cliff - I created a Lookup IDs token as you suggested (created it before the for each, appended it with info in the for each, and placed a token tracker at the end of the workflow).  I appended the student ID to this token, and each was reported.  I then ran the workflow again, but this time appended a piece of info from the database lookup (student last name) and the same name was repeated for each iteration of the for each statement.  I finally concatenated the last name result in the for each with the student id used in the for each, and this is what I see:

In this test workflow, I have created an ID token that contains 3 IDs.  The foreachvalue_iteration shows 3, so I know my for each statement ran all 3 times as it should have.  I can also see that lookupIDs is properly recording each ID each time.  But it is taking the student last name from the first ID and repeating that each time.  Any ideas why that might be the case?

0 0
replied on September 15, 2015

It sounds like you're not using the "current value" tokens like Cliff mentioned above. Could you post screenshots of your workflow activities, please?

1 0
replied on September 15, 2015 Show version history

I assume you are using the Custom Query or Query Data activities to retrieve the data.  Are you sure the SQL queries are being built correctly to pull back discrete records?  Can you share how you are building your query strings?  Perhaps you can use the same append tokens approach to capture the actual SQL queries that you are sending to the database to make sure the queries are accurate and not pulling back the same record each query?
 

1 0
replied on September 15, 2015

Sure, here is a screenshot.  Let me know if I can provide further details.

0 0
replied on September 15, 2015

Add a Track Tokens inside For Each Value so we can see the values at each iteration.

0 0
replied on September 15, 2015 Show version history

Chris - It has to be the query or how you are retrieving the values from the query results.  I duplicated your workflow/database on my system and get three records back;

Here is how I concatenated the Return Rows multi-value token to see the results of the query;

 

1 0
replied on September 15, 2015

Ok, this is strange.  I moved the track tokens activity inside of the for each, and it displayed the concatenated values correctly (different name for each ID).  I then moved it back out to the end of the workflow, and it still displays correctly, even though the workflow is now back to what it looked like originally when it did not work.

So, with technical issues out of the way, I am back to my original question.  I need to see what the 50+ values I am pulling for each ID are.  I was hoping that the tokens tab in the designer would record each set of tracked tokens within a for each activity separately.  Is this not possible?  If not, it would be a great addition to the tokens tab in a future release.  If it is not possible, am I going to have to concatenate each set of 50+ values together into a token so that I can review what each database lookup returned?

0 0
replied on September 15, 2015

If Track Tokens is inside a For Each activity, then you will get one entry in the list in the Tokens tab for each run (with the activity name and the time it ran).

1 0
replied on September 15, 2015

That is great to hear, as that is how I expected it should work.  However, I just placed the track tokens activity back inside of the for each, and this is what I get on the tokens tab:

I see in Cliff's screenshot above that he sees a track tokens icon in the "Select an activity..." window, but I am not seeing that option.  No matter where I place the track tokens activity, or how many track tokens activities I place in a workflow, I only see the two (All Activities) and the [name of the workflow] options.

0 0
replied on September 15, 2015

Hmmm, I don't think there is a native way to do what you are looking for. 

Myself I would not try to concatenate 50+ SQL field values into a token entry either!  If you are concerned about whether or not the records are unique I would just concatenate a couple of fields to make sure I was getting unique records and then go to SQL itself if I needed to troubleshoot what might be wrong with the query (i.e. returning more than 1 record for a unique id or returning the wrong record, etc)

 

replied on September 15, 2015

Can you post a screenshot of the Workflow tab from the instance details? It sounds like your For Each activity is not iterating at all.

1 0
replied on September 15, 2015 Show version history

Sure, here is the workflow tab:

Here is more of the previous screenshot showing that all three passes through the for each statement were made:

Additionally, here are the activity steps to that effect:

0 0
SELECTED ANSWER
replied on September 16, 2015

That actually looks like your server defaults have been modified to not record token data. Look in the WF Admin Console under Server Configuration\Advanced Server Options on the Workflow tab. The Default options would apply to any new workflow. Pick your workflow name from the list and make sure that "Tokens" is checked under "Track the following messages".

1 0
replied on September 16, 2015 Show version history

Ok, I found the option under Properties.  For that workflow, as well as the default for all workflows, tracking tokens was not selected.  I have now added that as a default for all workflows.  I have gone back and rerun my original workflow, but I am still not seeing any track tokens icons, much less distinct track tokens icons, on the Tokens tab of the designer.

0 0
replied on September 16, 2015

Try republishing the workflow first.

1 0
replied on September 16, 2015

Just tried republishing/rerunning, but no change.

0 0
replied on September 16, 2015

Just double-checking, you changed the "track tokens" checkbox both for the default settings and for this workflow specifically, right?

1 0
replied on September 16, 2015

Alas, I had not.  For some reason I was thinking changing the default would propagate the change throughout all of the existing workflows, but of course it makes sense that it would not.

Republishing and rerunning the workflow now shows the Track Token instances on the Tokens tab!  Thank you!

One last question: Is there any way to make each Track Tokens entry on this tab display the For Each value (in my case the student ID, so I know which Track Tokens entry to look for if I am scrolling through many) instead of just displaying the run time?

0 0
replied on September 16, 2015

Not quite, though the times will be sequential so you can follow the iterations through. You can track the iteration token as well so you have a way to double-check it.

1 0
replied on September 16, 2015

Dynamic naming of activities within For Each statements, even if only in the Tokens tab, would be a useful addition in a future release.

Thanks again, Miruna.  I appreciate the assistance.

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

Sign in to reply to this post.