I have a workflow where I am retrieving access items from a certification based on reviewer using the ISC API, the results are limited to 100 at a time in order for a subsequent loop workflow to work successfully.
The HTTP request gets created as a JSON object that looks something like this:
I am retrieving the count value from the headers using the json path expression
$.hTTPRequest.headers.X-Total-Count[0]
This returns the value “643” but as a string. Is there anyway to convert this to a number with define variable in ISC workflows?
I want to do a compare numbers to see if this number is greater than 100 and if so make another HTTP request to retrieve the next 100 items to pass to the loop workflow.
Hi Irshaad!
I don’t think that this can be solved with OOTB workflow tools at the moment.
A workaround would be to make a HTTP request to this public math api and do the comparison there: https://api.mathjs.org/
I would be careful with using string comparison to compare numbers. String comparison compares each character from left to right as opposed to the actual value. So the string “100” will be less than the string “9”.
Thanks @colin_mckibben, I ended up with a different approach which isn’t ideal but don’t seem to have another option right now. I limit a 100 at a time on each HTTP request and before proceeding to pass it to the next workflow to loop through the results I check if there are any results returned with a compare boolean to see if the result is null.
The problem with this is I have to predefine how many time the workflow will actually attempt to check for the next 100 set of results as I can’t do a number compare against the count.