First off, let me say the workflow conditions aren’t working as I expect them to
Let me paint a picture:
my invoice has 3 lines with 3 different departments (dept1, dept4, dept5 for simplicity sake)
The workflow it gets submitted to has steps and conditions like this:
step1: If Journal Lines.Department = dept1
step2: If Journal Lines.Department = dept2
step3: If Journal Lines.Department = dept3
step4: If Journal Lines.Department not = dept1
and Journal Lines.Department not = dept2
Journal Lines.Department and not = dept3
Step1 evaluates to true when tested against invoice above
Step2 evaluates to false
Step3 evaluates to false
Step4 evaluates to false (this is where I’m extremely confused). What do i have wrong? Is there a right way to set this up compared to what I have?
The condition says that department mustn’t be dept1 AND (in the same time) it mustn’t be dept2 AND (in the same time) it mustn’t be dept3.
¬1 ∧ ¬0 ∧ ¬0 = 0 ∧ 1 ∧ 1 = 0
Did I get it right?
Correct, It must not be any of the departments listed in the condition. My expectation is that this is evaluated on a line by line basis. So I expect line 1 to register false and I expect lines 2 and 3 to register true. The way you are stating your response makes me think that all lines have to pass the step 4 criteria so it is evaluated as true. If that is the case, my condition becomes increasingly complex with the more departments I add. If that is not the case, I’m not sure how best to set it up so that it looks at any one line not being from another department.
Sorry, I’m by no mean a workflow expert. I tried to configure something similar and it actually looks good to me. AX generated XPath query like this, which seems to do what you want:
ExpressionDocument[((MainTable/Line[SomeField != 1 and SomeField != 2]))]
Could check how the query looks in your case? It’s in ExpressionTable.XPathQuery (you can find the ExpressionId in WorkflowStepTable.ExecuteStepId).
the catch all looks like this
//ExpressionDocument[
(
(LedgerJournalTable_1/LedgerJournalTrans_1
[
count(…/LedgerJournalTrans_1) = count(…/LedgerJournalTrans_1[Dimension_1_ != ‘dept1’]) and
count(…/LedgerJournalTrans_1) = count(…/LedgerJournalTrans_1[Dimension_1_ != ‘dept2’]) and
count(…/LedgerJournalTrans_1) = count(…/LedgerJournalTrans_1[Dimension_1_ != ‘dept3’])
]
)
)
]
If i’m reading it right, it says the count of lines needs to = the count of lines that are not dept1 and the count of lines needs to = the count of lines that are not dept2 and the count of lines needs to = the count of lines that are not dept3.
To me it needs to say something like: the count of lines needs to not = (the count of lines that are not dept1 + the count of lines needs to = the count of lines that are not dept2 + the count of lines needs to = the count of lines that are not dept3).
I’m not sure how that xpath query would look
Rephrase:
To me it needs to say something like: the count of lines needs to not = (the count of lines that are not dept1 + the count of lines that are not dept2 + the count of lines that are not dept3).