Select to view content in your preferred language

Workflow manager server path logic based on step output value

1085
6
Jump to solution
05-30-2022 12:50 AM
StefanDieters
New Contributor II

I am trying to branch in my workflow based upon the output value 'errorsIdentified' of the EvaluateDataQuality step. This is for the server version using Enterprise 10.9.1 and Pro 2.9.

I have tried setting the Path Logic using Expressions with the expression :

Path 1 out of Evaluate Data Quality

jobOutputValue($job, 'e876f36d-2683-e499-ae54-f44430d04daa', 'errorsIdentified') >0

Path 2 out of Evaluate Data Quality

jobOutputValue($job, 'e876f36d-2683-e499-ae54-f44430d04daa', 'errorsIdentified') = 0

The workflow fails after the Evaluate Data Quality step with a message  "No paths match return code"

If have tried first branching on the return code from Evaluate Data Quality, placing a manual step on the "success output" and then again using the above expression. Same result.

StefanDieters_1-1653896622357.png

StefanDieters_2-1653896950666.png

 

Any ideas ?

0 Kudos
1 Solution

Accepted Solutions
StefanDieters
New Contributor II

Hello all.

I have managed to get this to work. Here is a close up of the diagram

StefanDieters_0-1655691922552.png

I have used the an extended properties table (switchtable with field nerrors) to hold the output value identifiedErrors from the EvaluateDataQuality. I have left the output as visible. This lets me change the stored value containing the number of identified errors. There are 3 paths out of the Update Job Properties step. The leftmost is triggered when the Update Job properties fails.

The rightmost leading back to the editor for when there are errors  has the expression:

Boolean(jobExtendedProperty($job, 'switchtable', 'nerrors') > 0)

The middle path leading on to a Reconcile and Post step when there are No Errors has the expression:

Boolean(!jobExtendedProperty($job, 'switchtable', 'nerrors') > 0)

i.e. the NOT of the other expression.

This works but

Boolean(jobExtendedProperty($job, 'switchtable', 'nerrors') == 0)

does not with a message saying there is no path.

Hope this help some-one else

 

View solution in original post

0 Kudos
6 Replies
JFarmer
Esri Contributor

Hi @StefanDieters 

I don't see anything inherently wrong with your Arcade expressions, assuming that step ID value is correct.

It would be good to know what the output value is that is being returned when the step runs. Can you check the jobProgress table in the hosted layer for your Workflow Item and see if the value being returned for errorsIdentified is equal to or greater than 0? 

Jonathan

0 Kudos
StefanDieters
New Contributor II

Instead of using joboutputvalue I put errorsIdentified into extended property table and use jobExtendedProperty($job, '<table_name>', '<field_name>'. With the table visible I am sure of the value going into the branching.

I have made some progress.If I use the expression :

Boolean(jobExtendedProperty($job, 'switchtable', 'nerrors') > 0) on the path back to the editor, that works. However the path errorsIdentified (nerrors in table switchtable) = 0 is never executed.

0 Kudos
JFarmer
Esri Contributor

@StefanDieters 

OK, I tested this and realized your expression was not actually correct. Sorry about that.

You need to use the double equal signs for this to work:

jobOutputValue($job, '5e8cd37e-fa09-494c-a8c6-c972824a7be2', 'errorsIdentified') == 0

This worked fine for me. 

Jonathan

0 Kudos
StefanDieters
New Contributor II

Thanks for checking. I later realized that error and updated the expression. Did not work either.

0 Kudos
StefanDieters
New Contributor II

Hello all.

I have managed to get this to work. Here is a close up of the diagram

StefanDieters_0-1655691922552.png

I have used the an extended properties table (switchtable with field nerrors) to hold the output value identifiedErrors from the EvaluateDataQuality. I have left the output as visible. This lets me change the stored value containing the number of identified errors. There are 3 paths out of the Update Job Properties step. The leftmost is triggered when the Update Job properties fails.

The rightmost leading back to the editor for when there are errors  has the expression:

Boolean(jobExtendedProperty($job, 'switchtable', 'nerrors') > 0)

The middle path leading on to a Reconcile and Post step when there are No Errors has the expression:

Boolean(!jobExtendedProperty($job, 'switchtable', 'nerrors') > 0)

i.e. the NOT of the other expression.

This works but

Boolean(jobExtendedProperty($job, 'switchtable', 'nerrors') == 0)

does not with a message saying there is no path.

Hope this help some-one else

 

0 Kudos
StefanDieters
New Contributor II

Last piece of puzzle: Thanks Razi of Australian esri support.

It appears == 0 returns the string representation of the value here and not the actual value (an integer).

In addition, core Arcade logic is playing a role here as well. In Arcade, the > and < operations will first try to evaluate the result as a string value. If that fails (because you aren't using a string), it will then try to evaluate the result as a integer, which is what we are using here. The == function doesn't have that same logic. It tries to compare a string to a string and then will fail if it can't.

So, if you would like to use == 0 logic, we would need to do either one of the following:

  1. Use Number(jobExtendedProperty($job, 'tablenew', 'arcade')) == 0 when using an integer value
  2. Or, use jobExtendedProperty($job, 'tablenew', 'arcade')) == '0' if you are ok with using a string representation of the value
0 Kudos