Merge 3 list of objects
Options
![Vikrant -1766326](https://us.v-cdn.net/6037124/uploads/userpics/O94TC2RFL0EQ/nIHNSZ89D34BB.png)
Vikrant -1766326
Member ✭
I have 3 arrays with a common id that I want to merge in the most efficient manner. I am not able to use an addon or join as the biggest of these 3 arrays is cached and comes as a variable and not directly from the database - I guess we can't join/merge at this stage. Array 1 has 300+ items, and the others have 10+ items each. How do you propose I efficiently merge the 3? I can't cache Array 2 and Array 3.
Array1: List of all products sold
Array2: Quantities of some products ordered by this user
Array3: Size information of this user
PS: Running a loop on Array1 is the only solution I can think of. But have questions on that methods efficiency.
Array1: List of all products sold
Array2: Quantities of some products ordered by this user
Array3: Size information of this user
PS: Running a loop on Array1 is the only solution I can think of. But have questions on that methods efficiency.
Comments
-
any comments?
-
These are all pretty low counts. I would not worry too much about the looping. Seems like you would be able to do this in a non-optimized situation with 300*(10+10) = 6000 iterations, which should be trivially fast. You can introduce "break" logic to make the number of iterations go down, but I am not sure you'll even notice the change in performance because at this small scale, it will go quick enough.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback