Almost! It's important to get familiar with the console and data structures for this work. The console is showing you a list. It's a nest list with different objects, each representing a day, a product and any orders.
Expanding each of the arrows by clicking on them will let you see if the data is being correctly structured and capturing what we think it should.
Also would be interested to see what the app is looking like too.
Your listview should be showing one repeater per date, and within that repeater should be a container with the date and a table of models and orders in it
You will want to adjust the table so that the columns match the field names in the array, but the table component should do a lot of that work for you anyway
Not only is that not returning any values, when I go back to the table view there is a red triangle with an exclamation point next to the columns I created and when I mouse over it, it says "More than one column has an id of 'orders'".
So, go back to what I mentioned before, the listview is using the array of data from format_orders.
Each entry in that array has a date and a list of associated orders.
In Retool terms each of those entries in the array is called an "item" in the listview.
So your date field is showing the item's date property
The table needs to show the item's order property
Each column of the table needs to show a property of the orders
So, what is the initial data source for the table? formatOrders? I assume not because I think that is what is causing me to only have 7 records, which is the number of days in the reporting range.
Also, Isn't what you are saying accomplished by mapping a value like {{ item.serial_no }} to the column Serial, {{ item.color }} to the column Color, etc.? That is what I am using, but I'm thinking it has something to do with the source data of the entire table. Is that correct?
You're right, the reason it's showing 7 records is because formatOrders has an array with 7 items in it, one for each day.
Listview should have formatOrders as it's data source
All the components within the listView don't need to reference formatOrders at all - they are using the "item"s in listView.
ListView will look at formatOrders data and find 7 entries.
It creates 7 boxes for you to add components into, so you see 7 tables
The 7 tables need an array to display their rows of data
Those rows of data are the "orders" that we have added to each of the items
So if the table uses item.orders as its data source that should be the list of orders for that date
Yes! It's working! I thought I would never see the day.
One last (I hope) question. For some reason it changed the order of the pool models on the left hand side. They are being pulled from another database and they need to be in a specific order, so I am a little confused why the order changed. Also, is there way to display the orders in the same order as the pools so they will match?
Yes, you can user array sort functions or lodash sortBy functions within the loops in formatOrders to get them into the sequence you want but that feels like the start of another conversation
Are they alphabetical or some other sequence?
And this is how it looks on the page right now. I really don't even understand how the order changed when it is pulling from a completely different database.
The list of pools is included in each of the orders, do you need that list on the left at all? You could display the pool name in each of the listview tables?
What query retrieves them and what does it order by?