Querying based blank and null values and date values

Options
n.stummann
n.stummann Member
edited October 2023 in ? Working with APIs

Hi,

I have some different columns. Som of the are blank ("") and some of them are null.

I would like to make an api call (using http endpoint for each data table), where I e.g. can retrieve all records where x column is null or where y column is blank ("").


Also, I can't get querying based on dates both unix epoch format and standard yyyy-mm-dd format to work.

Does anyone of you know how to do that?

Answers

  • lesa
    lesa Member, Administrator

    ADMIN

    Options

    Hi N,

    For your first question, In your configuration, you will need to make use of the "is_empty" filter. It will pick up on the different variations of an empty field.

    For the second question, try using an if-condition and place your date-based queries in there and the date filters should show up.

    Feel free to share a loom if you'd like a more in-depth solution.

  • n.stummann
    Options

    Hi there,

    Thank you.

    1. Okay, so I should creating a is_empty variable and then query those that is = true?
    2. I am working in python - do you have a have script example?

    This doesn't work..

    2.a. how can I request records on a specfic date

    2.b. how can I request records after or before a specific date?

  • lesa
    lesa Member, Administrator

    ADMIN

    edited November 2023
    Options

    Hi N

    So for the first question, here's how I implemented this logic on my side.

    Step 1: Created a variable called "list" that is an array

    Step 2 : Queried the relevant table with no custom query defined

    Step 3: Added a for each loop so I can go through each item in the response from Step 2

    Step 4: Added an if condition that checks if the current item's token is empty (this is where you will specify the columns you want the conditions to check for. Instead of using " = null" or " = """, is_empty will check for any types of empty records so it is the safer option)

    Step 5: If the condition comes through as true, I am then adding the item to our list from Step 1 using the "Add to end" option under Data Manipulation>Arrays.

    Unfortunately I do not have a script you could use but I would recommend checking ChatGPT.

    For your second question

    You could pass a specific date as an input and inside the query, use that input to define your query.

    If you would like to go over this on call, we have 2 free Office Hours sessions every Tuesday at 10am and 5pm PST where we go over any issues customers are facing and guide them through it.

    Here's the link to sign up. Alternatively, if you still need some help, feel free to drop a loom here so I can give more detailed guidance.