SelectNode Use Examples
Basic Use Example
In this example, we have a Node followed by a SelectNode. If we run in step so that the SelectNode does not have a chance to run yet, the Node output has 5 results.
If we look at the SelectNode configuration, we can see the StartIndex is set to 1 and the EndIndex is set to 3. Since I gave each of our nodes a visible index, after SelectNode runs, we will be able to expand the node and see which indexes were selected and which were dropped from the logs.
In the logs below we can see only 3 Node results are present. If we expand them, the nodes left have an index value of 1, 2, and 3.
SelectNode successfully selected a subset of the given Node and altered the logs to only display the range given by the StartIndex and EndIndex. Here is how the SelectNode logs appear:
Using 0 for StartIndex
The SelectNode service starts the indexing of the Node at 1. So, when you give it a StartIndex of 0, it still has the same behavior as if it were given a StartIndex of 1.
Used in a REST API for Paging of Results
In this example, SelectNode was usedin a GetOrderDetails REST API. The REST request would send an input of the StartIndex and EndIndex. This way the request could specify “I want only the first 10 results”. This is because the page would only show 10 at a time. Then as the user wanted to scroll through other pages, the API could be called again with a StartIndex of 11 and EndIndex of 20. Here is the process canvas for this API and the input in EASYProcess vs the JSON request used to call the API.
First we are going to call the API without sending a FromRecord or ToRecord. The default behavior it to select 1 and 999 when no values are passed in so that the results are not limited. Here is that logs in the SelectNode service:
In the logs, we can see that this order has 4 records returned from GetOrderDetails.
Next we are going to call the API with a ToRecord of 2 and a FromRecord of 1. After looking at the logs, we can see the same order has its GetOrderDetails results limited to 2: