Create_object filter no returning entry from a null value.

Options

I have two lists, key_list = ["a", "b", "c"], values_list = [1,2,null]. The create_object filter will return

{"a":1, "b":2}, the entry with null will not be included. What can I do to ensure I return {"a":1, "b":2, "c":null}?

Comments

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    Hi @Alimama ! 👋

    The create_object filter doesn't currently handle the null value. This is an issue that we are currently tracking. In the meantime, if you know precisely which key in the object you want the value to be null, you can update the variable and set that specific key to null.

    Here is an example of how to do this:

    Otherwise, if you expect your data to look different every time this function runs, and you don't know which property will contain the value null, you can implement something like this: https://www.loom.com/share/b40a00e8e1984d818ee0554f5879d80b?sid=5859d70e-89e3-4dc7-a5f5-8b957afb2986

    Let me know if this is helpful! 😊

  • Alimama
    Alimama Member
    Options

    Hi @lizanaya.

    Thanks so much for helping out. This helps to solve the problem! 👍️

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    edited June 2023
    Options

    Awesome, @Alimama ! 🎉 Glad to hear the workaround solved the problem!

  • Alimama
    Alimama Member
    Options

    Hi @lizanaya

    Once more, many thanks!

    In your example, you used key_list = ["a", "b", "c"], values_list = [1,2,0], what if the values_list = [1,2,null]? I think it still gives {"a":1, "b":2}, instead of  {"a":1, "b":2, "c":null}. The aim is to ensure it returns  {"a":1, "b":2, "c":null}, it should simply return all values, null or not. Any chance you can help with this?

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    @Alimama

    First of all, thank you so much for bringing this to our attention last week! We've looked into it and found the bug, and the fix will be included in our upcoming release later this week. We'll make sure to keep you updated by announcing the release here in our community so you know when this is up and working. 😊

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    Hi @Alimama !

    Wanted to give you an update and let you know that a solution is now available to have null values persist when creating an object. Check out this video with the solution, and let me know if it's helpful. 😄