What is the Purpose of the Second Value in Pipedream's Filter Action When Checking if a Key Exists?

This topic was automatically generated from Slack. You can find the original thread here.

I’m doing a lot of stuff with pipedream but today I’m stuck on a simple filter action:
Action: Continue execution if a condition Is met
Version: 0.0.2
Condition: [Object] Key exists and is not null or undefined
Initial Value: {{steps.query_database.$return_value.results[0].id}}

Second Value?!? Whats that for if I want to check if the key exists? I don’t get it :wink:

Thank you, best,
Richie

You’re really close, it’s a bit of a odd filter.

The 2nd value is the object not the specific attribute within the object.

Based on the value you shared, it sounds like you’re passing a specific attribute called id

The first value is probably supposed to be the results object, and the second value is the id attribute that you’re testing for

Ahh…ok…thank you…I understand…a little :wink: So, I tried to give the object as 2nd:
{{steps.query_database.$return_value.results}}
and the attribute as 1st:
{{steps.query_database.$return_value.results[0].id}}
I tried it so and vice versa, but It didn’t work. Do you have any example for this filter?

You’re very very close.

The 2nd argument should be the property name not the property value.

When you enter in {{steps.query_database.$return_value.results[0].id}} the double brackets ({{ }}) instruct Pipedream to evaluate that JavaScript statement.

If you simply enter in the attribute name of id then you might have better luck.

Additionally, it looks like you’re accessing results[0].id, which means results is an array of objects, not a single object.

If that’s the case, it sounds like you might be reaching for the wrong filter, because the array could be empty and not contain any objects.