add list of table reference

Options
Hi,

Can you help me about this ?

I have a column, table reference list in integer

When i try to add one or some link in stack , there is an error : requires a scalar value,
I try append, push, but i can't find how do this ?

In my external API, i receive a Booking, connect to a rental,
I add my booking in the table, but i can't join this booking to my rental ( a rental can have multiple bookings)

Thanks ! [Capture d’écran 2021-12-28 à 13.10.42.png]

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Hi  -

    I notice a couple things here. First off your bookings_id field looks to be an array of text. You are trying to map it to an object data type. You must have the same data types (i.e. text to text)

    Push and Append are filters reserved for arrays [], these filters will not work for an object {}

    Your Rental Bookings variable looks to be using GET to retrieve some value. If this is a scalar text value then you can set the data type to array [] and use the push filter. If Rental Bookings is an array then you will want just put the variable on that input line.

    [CleanShot 2021-12-28 at 16.57.21.png]
  • Victor Nihoul
    Options
     Could you clarify the process of updating arrays?

    We understood with  that we had to use an array of integer, representing the list of objects unique IDs.

    We could use the push function to add an item to the array but now our question would be: is there any other function that we can use with such arrays of unique ID? Or any documentation?

    We're especially looking for a way to tell Xano "Add this item to the array if not already in the array" but to us, it feels too much to create multi-step actions flow just to make this happen, is there a simple way to do it?

    Thanks!
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     Xano performs full object replacements. So if your means of updating an existing array is to add on to one. You must first get the existing array and update it. 

    I would just apply the unique filter to ensure your array has unique values. 
  • Gregory
    Options
    really sorry  but i don't understand, 

    Can you show me how add a list of table reference in an array please ? 

    I have a base with 100 different amenity , with each an id and a name 
    [Capture d’écran 2021-12-31 à 18.20.40.png]
    I have another base with rentals , and each rentals have different link to a list of amenity
    [Capture d’écran 2021-12-31 à 18.24.12.png]And i have an external webhook, who send me a rental with a list of id ( not Xano Id, but Bs ID )
    [Capture d’écran 2021-12-31 à 18.27.22.png]
    When it's a succes, Xano add me the good numbers of rows , but empty... there is no link with the amenity table
    [Capture d’écran 2021-12-31 à 18.29.52.png]I try a lot of combinaisons.. but not found the great ! 
    Thanks in advance 
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     - I'm seeing two different fields based on the photos you sent - so maybe there is some confusion on where you are adding things?

    amenity_id vs rentals_amenities

    [CleanShot 2022-01-03 at 14.49.04.png]
    Hopefully that clears it up but if not, maybe sign up for an upcoming office hours if you need some more hands on guidance.