How do I setup a filter to verify if an array is empty?

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

how do i setup a filter to check whether an array is empty or not?

To set up a filter in Pipedream to check whether an array is empty or not, you can use the Filter app to specify a condition that your workflow must meet. Here’s how you can do it: 1. Search for the Filter app from the step menu: - In your Pipedream workflow, add a new step. - Search for the “Filter” app. 2. Select the “End execution if a condition is met” action: - Choose the action “End execution if a condition is met”. 3. Connect your Filter account: - If you haven’t connected your Filter account yet, you’ll need to do so. 4. Select an Initial value or pass any from a previous step: - For the initial value, you can pass the array you want to check. This can be done by referencing the output of a previous step that contains the array. 5. Select a Condition or pass a string from a previous step: - For the condition, you will need to check if the array is empty. You can use a JavaScript expression to do this. For example, you can use the following condition: steps.previous_step_name.array.length === 0 Replace previous_step_name with the actual name of the previous step that contains the array. 6. Test the configuration: - At the bottom of the step, click “Test” to run the action and test the configuration. Here’s an example Pipedream component code that demonstrates how to check if an array is empty and end the workflow if it is: import { axios } from "@pipedream/platform"; export default defineComponent({ props: { filter: { type: "app", app: "filter", }, array: { type: "string[]", label: "Array", description: "The array to check if it's empty", }, }, async run({ steps, $ }) { const array = this.array; if (array.length === 0) { $.flow.exit("Ending workflow early because the array is empty"); } else { $.export("$summary", "Continuing workflow, since the array is not empty."); } }, }); In this example: - The array prop is defined to accept an array of strings. - The `run

{{steps.query_database.$return_value.results.array.length}} === 0

is this how i would write the expression ?

To check if the length of the array returned by {{steps.query_database.$return_value.results.array}} is equal to 0, you can use the following expression: {{steps.query_database.$return_value.results.array.length === 0}} This expression will evaluate to true if the length of the array is 0, and false otherwise. If you have any further questions or need additional assistance, please let me know!

Condition operation not supported

It seems like you’re encountering an error related to a “Condition operation not supported.” To help you better, I need a bit more information: 1. Could you provide more context on where you’re seeing this error? For example, is it occurring in a specific Pipedream component, a custom code step, or somewhere else? 2. What specific condition or operation are you trying to perform? 3. If possible, could you share the relevant code or configuration that is leading to this error? With this additional information, I can provide a more accurate and helpful response.