I have an XOR and i need to loop through the following data and pull out customer name and evaluate each decision point based on the customer name:
here is the data:
[{"dateReceived":{"value":"2025-02-10Z","spanId":"342b49c8"},"dateOfInjury":{"value":"1995-12-20Z","spanId":"0a319d52"},"customerName":{"value":"State Fund","spanId":"d60519e4"},"name":{"value":"Kenneth A Lawson","spanId":"df37d1c3"},"claimNumber":{"value":"SD165263","spanId":"fc983c31"},"sendersName":null,"sendersPhoneNumber":{"value":"(209) 476-2626","spanId":"9ad8be0a"},"sendersEmailAddress":{"value":"","spanId":""},"services":{"value":"Bilateral splint strap","spanId":"6deae02e"}}];[{"dateReceived":{"value":"2025-02-12Z","spanId":"47f94d4a"},"dateOfInjury":{"value":"2011-05-05Z","spanId":"bc8e2f01"},"customerName":{"value":"State Fund","spanId":"716db1d0"},"name":{"value":"Ms. Rosa Penns","spanId":"afd94968"},"claimNumber":{"value":"05700220","spanId":"75a5d369"},"sendersName":null,"sendersPhoneNumber":{"value":"1.844.583.5412","spanId":"47f94d4a"},"sendersEmailAddress":{"value":"","spanId":"47f94d4a"},"services":[{"value":"TENS unit patches x120","spanId":"975b7c13"},{"value":"Left knee Compressions","spanId":"bebcaf04"}]}];[{"dateReceived":{"value":"2025-02-13Z","spanId":"763bdad5"},"dateOfInjury":{"value":"2011-12-27Z","spanId":"218c17dc"},"customerName":{"value":"Travelers","spanId":"7381de7e"},"name":{"value":"Ms. Ana Jones","spanId":"11c0d766"},"claimNumber":{"value":"ERX3004","spanId":"f48a4be6"},"sendersName":null,"sendersPhoneNumber":{"value":"1.844.907.2911","spanId":"5add2a0d"},"sendersEmailAddress":{"value":"","spanId":"1ac47056"},"services":[{"value":"MRI of the left hip without contrast to rule out post surgical changes, reports gradual worsening of the pain after fall in Oct (please assist for Hanford Imaging Center).","spanId":"98c6b3d5"},{"value":"Evaluation and Treatment with Orthopedic Surgeon Left Hand","spanId":"fef62b95"},{"value":"Ibuprofen 400mg 1 Tablet every 6-8 hours PRN #30 X 3 Refills\nLidocaine 5% Patch qday PRN #30 X 3 Refills","spanId":"fe9617a1,d1fe6f0b"}]}]here are my condition code:conidtion 1:=contains( {"state fund", "hartford", "the hartford", "zurich"}, lower(trim(a!forEach( items: pv!processVar34, expression: a!fromJson(fv!item).customerName.value))))condtion 2:contains( a!forEach( items: pv!processVar34, expression: a!localVariables( local!parsedJson: a!fromJson(fv!item), if( or( isnull(local!parsedJson), isnull(local!parsedJson.customerName), isnull(local!parsedJson.customerName.value) ), "", lower(trim(local!parsedJson.customerName.value)) ) ) ), "travelers")thanks so much!
Discussion posts and replies are publicly visible
This is the sort of thing where I recommend writing it as an Expression Rule (where you're able to set up any test data set you want with trivial ease) and then call the expression rule from your process model (especially in an XOR node, since code entered there will be flattened to 1 line upon saving).
As far as your logic, I'm a little fuzzy on what you're asking for but as usual, it should be plenty doable to iterate over a list using a!forEach() and to check that each member of the list satisfies your conditions, etc. And doing this in an expression rule, of course, makes this very easy to test.