Step 2: Skip records based on Customer_ID
To skip records based on the values for Customer_ID provided by the user as StartupParameters, actions need to be defined with the shared variable StartupParameters in the “On Reading record” function.
To define the Actions, go to the Code tab>On Reading record function and expand it. To add an “Action box”, click the [+ Action box] button.
To convert the value received in the Join_Date to integer, add and define an Action in the Code tab.
Define the Action as follows. (This value will be used to format the Join_Date later in the exercise):
Select Action as “Update Variable”.
Select Target Value as “defJoinDay”.
Select Value as “reader.Join_Date.toInteger()”.
To traverse the list of StartupParameters provided by the user, add and define another action as follows:
Select Action as “Traverse List”.
Select List as “StartupParameters”.
The Variable “item” is created.
To verify if any of the entered values in StartupParameters (read as item) match with the Customer_ID, add and define a “Condition action” in the “Traverse List”:
Select Action as “Condition action”.
Enter the Label as “if Customer_ID equals item”.
To check if the values read in the Traverse List item match the value of Customer_ID, add a Criteria bar in the “Criteria” tab as follows:
Select Target Value as “reader.Customer_ID”.
Select Operator as “Is Equal”.
Select Source as “item”.
To define actions if the criteria is returned as True, in the Code tab>On True section, add and define the following actions:
Action: “Update Variable”, Target Value: “skipRecord”, Value: “true” (record should be skipped)
Action: “Update Variable”, Target Value: “skippedReason”, Value: “Customer is not eligible for this program.” (add reason for skipping the record)
Action: “Break List traverse”(break the loop once all Customer_IDs are traversed and verified)
Last updated