Create Table References Based on External IDs

Options

Hello everyone,

I followed the video below to create references Based on External IDs on the table containing 600 records :

Here is the function I created to perform this action: 


It seems to work but...only 70 records are processed...

Looking at the video again, it seems that it is necessary to configure the pagination in xano to deal with "large volume" but I don't really see how to proceed...

Does anyone have an idea?

Thanks in advance for your help 

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    The logic would for sure be different with paging turned on, you'd have to recursively call each page with a while loop... but luckily, we make things easier than that with the Stream return type, which works exclusively with For Each Loops... so in your case I would use the Stream return type on Query All Records from Worker...


    Also, looking at your function stack, it doesn't look like you're actually editing the records - you will need to do that in order to update your database.

  • Mamad
    Mamad Member
    Options

    Hi Michael ! Thank you for your answer and for your great video 😃

    I'm checking this type and it's definitely what i need. thank you, by the way, i have another question , how can i deal with creating a similar function but the goal is to create multiple table reference for the same record ( one to many ) ?

    ps : about the edit step , yes i saw that after making my screenshot 😊 .


    Merry Christmas to you and all the XANO team 🎄

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options

    @Mamad - it depends on your schema set up

    For example, I could have a one-to-many like this:

    Company
     id
     company_name
    
    Employee
     id
     employee_name
     company_id
    

    With this setup, the function stack should look similar to the video.

    Or you could have something like this:

    Company
     id
     company_name
     [] employee_id
    
    Employee
     id
     employee_name
    

    Where [] is a list (array) of employee ids. With this set up, you'd want to use the function Array: Find ALL Elements.

    This would produce a list (array) of matching employee ids for the company, which you could insert into the company table.