How do I ignore "null" values from $response


#1

I’m using the “Make Web Request” to interface with an API, then setting a variable to be the $response from that web call. The variable is set as an expression “$response.first” , “$response.second”. There are some times that one of the $response is “null” which is ok, but The variable ends up being “null, something” or “something, null”. How can I ignore a “null” response?


#2

After the web request, you can add an IF command like this:

IF $response.first is not null
Then
    Set variable to whatever
END IF

#3

I have a similar but no exact situation, I am able to parse a response to pull relevant data but I am wondering what the best method would be to find the first “irregular” value. The data is sectioned into weeks. The first week is identified as group 0 ($response.week[0] returns 1, offset of 1). There are empty weeks that the API skips for example if week 6 was blank the 5th entry would correspond to week 7 ($response.week[5] = 7). What is the best method to determine when the offset changes to >1? I am trying to avoid a bunch of nested if statements if possible.


#4

Without seeing your code, maybe something like this:

IF $response.weeks[X] is greater than (X+1)

where X is an integer variable that has (no value set) up top…


So, using your example:
$response.weeks[5] = 7
and 7 is greater than (5+1)