List item expression problem

good morning to all guys. I am using listitem expressions to pass a series of data to my external backend. Now I find myself with the following problem. I should only pass it the “Order Items” where the dish mapping menu (foreign key) is not empty, and I used the following code. Now I’m not getting any more errors, however I always pass them an empty array, does anyone know what the problem may be?

JSON.stringify({

    "piatti" : item().lookup("Order Items").filter(function(order_item){return order_item.lookup("Menu Dish Mapping") !== null}).map(function(order_item){

    return{

    "nome" : order_item.lookup("Menu Dish Mapping").lookup("Dish").lookup("Dish Name"),

    "quantita" : order_item.lookup("Quantity"),

    "note" : order_item.lookup("Richieste"),

    "total_price" : order_item.lookup("Total Price")

    }

    })

    })

Specifically I should pass the data from this table to him. As you can see I should pass him the 3 circled data and not pass him the one where “menu dish mapping” is empty, in this regard I used the filter, but it always passes an empty array.

This topic was automatically closed after 70 days. New replies are no longer allowed.