Best practice for creating new set of records for existing population of records

Brand new to retool so please excuse my ignorance.

What is the best way in retool to present users with a view/form where for each company(all companies are listed at once) in their portfolio(where the dynamic population of companies is pulled from the SQL db) as of a user defined date and next to each listed company is an input field to enter a new price and the gain/loss would be calculated from the old price, and a bulk insert would create the new records on the valuation table. Each day would have a new "set" of prices for the population of companies.

Is listview the proper path or json form? I know the table object in retool gets you pretty close and you can do bulk update of existing records, but without a single record form where you are creating new price records one by one I'm not sure how to get it to the exact functionality where it creates a new set of bulk records instead of bulk updating existing records.

Thanks so much in advance!!

I might try the listview. However, I would not have the listview directly tied to the query.data, but to an object array that you control.

Create a temp var (we'll call it tempData) and assign the query.data property to it. Add your properties (newPrice and so on) to it. Populate the listview from tempData with the appropriate input components.

The user edits the data and clicks Save or whatever. You then create a new array from the changed values and use that for the bulk query.

That's kinda high level explanation, let me know if you need clarifications after you have digested.

2 Likes

Hey there, I agree with Bradley's suggestion! This would be a good use case for a listview component (here are the docs for Retool's listview component: https://docs.retool.com/docs/working-with-listviews) and it would be a good idea to populate your listview from a temp state variable that you build from your query.data. Does this work for your use case?

1 Like

Makes sense. Apologies for the extremely tardy response on this; I was not able to take a long until now. Thanks again!