amparo
#1
Hi,
I use HTTP module, which returns array of objects (data[]). Each item has ID and EMAIL (data = [{ID: 123, EMAIL: “xyz”},{ID: 345, EMAIL: “xyz”}])
I want to filter them, only to include every object, which has ID 123 (there may be multiple of them).
Current approach
- HTTP – response is automatically converted to an array of objects JSON (aka →
data[]
and each item has ID and EMAIL)
- Set filter →
data[].ID
equals 457
- After running it will return 0 results (does not return objects with ID 123) → ID 123 exists!
Possible fix → Use ITERATOR
- HTTP
- ITERATOR
- Set filter →
ITERATOR.ID
equals 123
- Filtering works
Is there a way how to handle this array without iterator?
@amparo
In this case, yes:
map(data;EMAIL;ID;123)
This will return a primitive array of the emails where the ID is “123”.
Jim - The Monday Man (YouTube Channel)
Watch Our Latest Video: The monday ITEM ID column - What most people don’t know.
Contact me directly here: Contact – The Monday Man
2 Likes
Hi, thank you!
Is there also a way to use smarter filter?
Let’s assume, there is EMAIL
, ID
, DATE
in each object in the array. (And I need only EMAILs as primitive array)
Right now I have in filter (after Iterator) {{parseDate(1.DATE; "YYYY-MM-DD")}}
less than {{addDays(setDate(now; 1); -30)}}
@amparo
To filter dates, use “real” dates (not strings, as you are already doing) AND Datetime comparators:
{{parseDate(1.DATE; "YYYY-MM-DD")}}
Earlier than {{addDays(setDate(now; 1); -30)}}
Jim - The Monday Man (YouTube Channel)
Watch Our Latest Video: The ITEM ID column - What most people don’t know.
Contact me directly here: Contact – The Monday Man
1 Like