Problem comparison between the highest value of an array and a numerical value

Hello everyone, I have a problem with NodeRed I'll explain what I'm trying to do so you have the context,

I make an http request using the GET method, I make this request on a web page that is only accessible from my local network, this page contains client sites with an ID that is assigned to each site.

When I execute this request I get information about the client sites (their name, the location of the building on the map thanks to the longitude latitude and their ID), Once the request is done, the output is redirected in a "function" node so that it removes all the information that I am not interested in, once the sorting is done,

the output is redirected to a "Join" node and I ask to join each msg.payload[2] (which corresponds to my IDs) and create an array composed of all my IDs, once my array of IDs is created, I use the command "msg.result = Math.max(...msg.payload[2]);" to make msg.result equal to the highest value of the array.

In parallel to this first request and its processing, I execute another
http request using also the GET method, I make this request on a web page which is also accessible only from my local network, this page contains information on PCs which are at different clients (the hostname, the IP, the Mac of the PC, at which client is the PC installed...)

So my goal is the following I want the 2nd request to be a request to know which PC is in which client site (this is already done),

that once the query has checked which PCs are stored in which client site, the query should then check another site without restarting the loop with the "inject" node (this is already done)

it is on this part that I need help:
and finally I want that if variable1 (which corresponds to the variable which increments of 1 with each cycle to be able to check another sites customer) is higher than the value contained in msg.result then the variable1 stops incrementing because it will have reached the value of the ID of the last site customer to be checked.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.