This topic was automatically generated from Slack. You can find the original thread here.
How are we able to test if something is null if it isn’t defined?
I thought these would mean the same thing
This topic was automatically generated from Slack. You can find the original thread here.
How are we able to test if something is null if it isn’t defined?
I thought these would mean the same thing
Tried making an easier step just for the sake of the filter working, but even this doesn’t seem to be right
Continue if the word ‘index’ is in the initial value
Which it is, it’s there… But Pipedream is saying it isn’t?
Am I missing something here
I normally add a python code step and do a try except on the step - in your example if it was a type error something like - not tested but should get you close
**try**:
pd.steps["find_email_in_Website_View_sheet"]["return_value"]["0"]
**except** TypeError:
**return** pd.flow.exit('Row Number doesnt exist')
Hi Daniel, for this Filter action null
and undefined
do mean the same thing.
The reason why [Text] Contains
does not work in your second screenshot is because the Initial Value
is an object, and when it tries to convert to a string
it outputs [object Object]
which is the JS default.
Assuming the step find_email_in_website_view_sheet
is a Google Sheets - Find Row action, I ran a test and mine returned 5 rows. You can see that in my first screenshot.
Using [Null] Is not null or undefined
for the first value in the array, it worked correctly as expected. You can see in my second screenshot the Initial value
is 2
, and that means that {{steps.find_row.$return_value[0].googleSheetsRowNumber}}
is 2
.
Please check that you are selecting the correct
Please verify that you are selecting the Initla value that you expect and that the type of the Initial value
that you expect and the type and use a compatible Condition
for that type.
Thanks for your response
I understand the steps entirely, however the issue is still present - because ‘googleSheetsRowNumber’ is only an output on the ‘Find Row’ step if the row is actually found
Therefore, if nothing was found - there is just simply no output, and therefore the following step (referencing ‘googleSheetsRowNumber’) doesn’t appear at all
And therefore not just doesn’t exist, but it can’t actually reference it to define if it exists, because it was never an output
Does that make more sense?
I really appreciate your time & effort above. Thanks.
If you have any way to solve this I’d be glad to hear
Here’s an example (like what you sent) where the googleSheetRowNumber is defined
Because it actually found a return value to calculate
This is completely gone if the email is not in the Sheet, and therefore isn’t just ‘undefined’ - but unable to be used as a step - because there is no output for it at all
Ah I see, then an option you have is to add another Filter
step before, checking if in the array there is a value, like in the screenshot below. Concatenating Filter
steps will act as an and
operator.
Sorry for running around in circles here mate
Tried it out & it’s still allowing the filter to pass, even though the result is [] - i.e. no email found
Any pointers?
When I test it with a valid email found, the result does work (data is in the Initial value)
But because it still says “[]” when there is no data, it still defaults to TRUE
I’ve even tried the most obvious solution - which is to check if the output is “[]” (meaning there was no email found) but this also fails
Not sure how other people do it but this is killing me lol
No problem at all
> Tried it out & it’s still allowing the filter to pass, even though the result is [] - i.e. no email found
Can you please try with steps.find_email_on_Sheet.$return_value[0]
? It’s missing the 0
index.
With the Continue based on condition
step, the condition can either be [Boolean] Evaluates to True
or [Null] Is not null or undefined
.
Figured it out - thanks for your help & @U04GL98P8Q2
It worked with referencing the path of “0” - and then it was able to determine if it was existing or not (even if nothing was previously found on the Sheet)
I had been using the path circled in Blue beforehand - which didn’t work when nothing existed
Very odd fix, but it works
Again, thank you both a lot for your effort