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

Question

Question

Matching Input Item Numbers and Amounts with JDE API Response on Cloud Instance

asked on August 3

Dear Team,

I have a requirement where I need to validate the input "Item Number" and "Line Amount" against the data returned by a JD Edwards API.

 

  • Step 1: We receive JSON files along with metadata, which includes values for "Item Number" and "Line Amount".

  • Step 2: This data is passed as multi-value input parameters to the workflow.

  • Step 3: Within the workflow, I use a “For Each Value” activity to iterate over each input "Item Number".

  • Step 4: Inside the loop, I use a Conditional Decision to compare each input "Item Number" with the "Item Numbers" returned in the JDE API response.

ForEachValue_CurrentValue = API Receipt LineItemNumber

Note: The token ForEachValue_CurrentValue holds the current input "Item Number" from the loop.

However, I'm unsure how to iterate over the API response "Line Item Numbers" to perform this comparison correctly.

 

Questions

  1. Is the current condition valid for checking each input "Item Number" against all "Item Numbers" in the JDE API response?

  2. How can we iterate over the JDE API response values, so that each input value can be compared one-by-one with the response values (i.e., each "Item Number" and "Line Amount")?

Match Scenario.png
0 0

Replies

replied on August 3 Show version history

Hi Shubham,

If the data returned by a JD Edwards API is a JSON object, you may choose JSON as the Preferred Response Format in the activity API Call

Then, we can use Read JSON to parse API response to a multi-value token just like Pattern Matching in the workflow. As I don't know the exact data structure, I assume we will get two multi-value tokens that contains Item Number and Line Amount just like the multi-value input parameters from JSON files.

After that, we can use For Each Value to iterate both Item Number from the input parameter and the token parsed from API response. Inside the loop, we can use the Iteration token to get matched Line Amount.

Now we can compare them one-by-one with the condition.

0 0
replied on August 4

Hi Zhujie Zhang,

Thank you for your prompt response.

Following your guidance, I’ve configured the workflow. However, I have a question regarding the comparison condition:

While using the "For Each Value" activity to iterate through the input item numbers, how can I retrieve the corresponding Line Amount from the input to compare it with the API response Line Amount?

As far as I understand, "For Each Value" processes one value at a time. So how do we access the matching Line Amount from the same position in the multi-value list?

Am I correct in this understanding?

Please refer attached screenshot.

Configured Condition.png
0 0
replied on August 4

Hi Shubham,

Here is the screenshot of a workflow to help understanding.

The first 4 steps create the 4 multi-value tokens corresponding to data parsed from JSON files and API Call. 

Then, it will go to the For Each Value part. 

To access the matching Line Amount from the same position in the multi-value list, we can use Assign Token Values to get it by Apply Index in the Token Dialog. For example, when For Each Values gets the third Item Number, this method will get the third Line Amount.

 

In this way, we can get Item Number and corresponding Line Amount from JSON files in the outside For Each Values and get Item Number and corresponding Line Amount from API Call in the inside For Each Values.

0 0
replied on August 4

Hi Zhujie,

Thank you for your prompt response.

The solution works about 90%. However, I'm now facing an issue with the conditional decision logic. If the first comparison set matches, the workflow proceeds through the "Found" branch and doesn't evaluate the remaining values.

Could you please shed some light on this behavior?

0 0
replied on August 4

Hi Shubham,

As I mentioned in the last post, there are two For Each Values. The loop combination allows us to iterate through all Item Numbers/ Line Amounts from API Call  for each Item Number/ Line Amount from JSON files. So the workflow will continue evaluating the remaining values after proceeding through the "Found" branch.

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

Sign in to reply to this post.