Skip to main content
September 3, 2024
Question

The length function is not working correctly without using flatten

  • September 3, 2024
  • 18 replies
  • 0 views
Here, the integrationResponse.result.body is an array of dictionaries. However, the length function returns 1 if not using flatten. Not sure why this is happening. Please share comments/reasons if any.

18 replies

stefanhelzle0001
September 3, 2024

Can you share a snippet of the raw JSON as returned by the API?

yogip3177Author
September 3, 2024
I am using the following URL in integration:
This URL is returning response in the following format:
[
  {
    "albumId": 1,
    "id": 1,
    "title": "accusamus beatae ad facilis cum similique qui sunt",
    "url": "https://via.placeholder.com/600/92c952",
    "thumbnailUrl": "https://via.placeholder.com/150/92c952"
  },
  {
    "albumId": 1,
    "id": 2,
    "title": "reprehenderit est deserunt velit ipsam",
    "url": "https://via.placeholder.com/600/771796",
    "thumbnailUrl": "https://via.placeholder.com/150/771796"
  }
]
Please let me know if you need any other details.
mikes0011
Brainy
September 5, 2024

Any chance you could try posting the raw unformatted JSON returned, representing the above 2-item array?  I'd be interested to try it in an expression and see how it behaves on my end.  (hopefully it won't get spammed again.)

mikes0011
Brainy
September 3, 2024

Length is one of the primitive functions and as such, its use is constrained by some picky (and sometimes unintuitive) back-end stuff.  I'm not sure exactly what's going on here of course but as Stefan mentioned, it might help to see some of the raw JSON data being returned.  My first guess is that it's being confused by the exact data type of the ".body" result, perhaps interpreting it as an array of 1 item consisting of an array of the 5000 items we see - or something like that.  a!flatten() will of course smoothe this out, explaining why the result you see with that is coming out better.  That doesn't indicate a "problem" with length(), per se, as much as the fact that there are weird corner cases where its (correct) behavior is unintuitive.

September 4, 2024

 [mention:a11f77a729fb4db2af76b09948583328:e9ed411860ed4f2ba0265705b8793d05] , [mention:b45a4f6a20b14a008e4e0ec732a8bf98:e9ed411860ed4f2ba0265705b8793d05] , sorry for the delay in replying.

Here, I am replying from my other account.

While I was replying to your thread, my account got frozen [emoticon:f46987a61e1246c8aea1dabe4dc68d98]. I am getting the following error:

"There is an issue with your user account: The allowed frequency of abusive content was exceeded (by 'Abusive User Detection by Abuse Frequency')."

Not sure what went wrong. I just entered a URL that I was using to get a JSON reply and pasted a snapshot of JSON reply. I have not added any abusive content.

Due to this, I am not able to participate in community activities as well [emoticon:2e0881b394ea47039c4b7e5eed46a79e].

Hopefully, the community admin will give access back to my account.

Please let me know if anyone have any ideas to resolve this.

mikes0011
Brainy
September 4, 2024
There is an issue with your user account

This has been happening to a bunch of us intermittently.  I've alerted the community admins for you.  They're working to straighten things out as they happen (i assume the spam filters are set too strong or something.)

September 4, 2024
OK. Thank You!
I appreciate your help.