Skip to Content
avatar image
Former Member

HCI - Global variable gets cleared after loop goes to next iteration in a Splitter - Gather step

Hey All,

Attached is a snapshot of an interface which integrates the new hires from a KRONOS system to SAP Onboarding.

Background:

The incoming XML file will contain multiple new hire details. Hence, Splitter + Gather in the integration flow.

There are 3 Request reply steps which are done for each employee

  1. SOAP call to post New Hires in Onboarding system (Once the employees are posted, the system generates a kmsUserID for each employee)
  2. Odata call to Get Applicant ID of the new Hire
  3. Odata call to set readyToHire field in MDF OnboardingCandidateInfo to true

Requirement: Error handling at each Request-Reply step

With regards to the second Request-Reply step- “Odata call to get the Applicant ID of the new Hire” after the odata call to get the applicant ID, I have added a router element which checks if the reply message has an applicant ID. If not, it exits the loop (Splitter - Gather set)

Strategy:

Suppose if multiple employees fail at different steps, the error would be Logged in the format of:

<kmsUserId>__________________________</kmsUserId>

<fail_step>Get Applicant Id</fail_step>

<kmsUserId>__________________________</kmsUserId>

<fail_step>readyToHire set</fail_step>

<kmsUserId>__________________________</kmsUserId>

<fail_step>readyToHire set</fail_step>

<kmsUserId>__________________________</kmsUserId>

<fail_step>Get Applicant Id</fail_step>

…………………..

This would show clearly which employee has failed and in which Request-Reply step.

Issue:

I have declared a Global Variable in the header which will retain the Error Log in the above format. In every iteration, the error log is Written to a local datastore and for the next iteration, it is retrieved from the Data store. Writing and getting from a local data store is not necessary as the error can be stored solely in a global variable. It gets cleared and that's why I tried writing it to a local DS. Doesn't work!

Script 1 which is present in the 3rd row right corner logs the value of the Error Log variable one step before the Gather step.

Script 2 which is present in the first row left corner logs the value of the same Error Log variable right after the Splitter step

The Error Log variable gets cleared everytime the Loop starts !!

Script 1 Output: Please see Attachment

Script 2 Output: Please see Attachment

Have any of you faced any issues like this? A variable getting cleared before the loop starts.

Note:

  • I have tried logging the error values without using GET WRITE (row 3) by just setting the error log variable using plain old script. Doesn’t work!
  • The garbage value before the <kmsUserId> tag in Script 1 output can be ignored.
snapshot.jpg (94.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 02 at 06:40 PM

    Hi Kriba,

    A quick check have you tried using property instead of header for the same scenario.

    (Global Variable in the header) -> try with property

    thanks and regards,

    Praveen T

    Add comment
    10|10000 characters needed characters exceeded

    • Hey Praveen,

      Thanks for our suggestion. However, I have tried that as well. But no matter. I changed the entire methodology and instead of saving the error in a global variable and processing it for each loop, I am now writing the error for each loop in a data store via the exception subprocess step and processing it.

      Thanks!