Manually add data to query data result and refresh collection

Hey there,

i am new to retool and love it! I am also new to JavaScript and web development, so please bear with me if the solution is too obvious.

I want to create an internal logistics app with Retool to replace our outdated system. The underlying system is a SAP Business One which provides a web api.

The first task I have set myself is to implement goods receipts based on goods orders. Here I retrieve the data from the purchase order, which contains a list of articles. With the goods receipt, however, also batch numbers are seized. So it can be that an article has different batch numbers.

My idea now was to simply copy the article in my CustomCollection and add it to the data set of the data source of the CustomCollection simply with .push. But the CustomCollection does not show the new data.

Does anyone have a solution here? Or maybe another way to solve this?

In case it matters, we are currently using the free version of Retool on Premise for testing.

Here are a screenshot:

In the Console left, you can see that the second object was added, but it is not shown in the CustomSollection.

Thanks for help!! :slight_smile:

Hey @Hendrik! The JavaScript you're using here makes a lot of sense, however, if you want to update the properties of a Retool component you can't do so directly. You might try storing your data using a Retool variable - with that, you could do yourVariable.setValue([...collectionView2.data, itemToAdd]) instead ofcollectionView2.data.push(itemToAdd). That also means that you'd want to reference {{ yourVariable.value }} as the data source for your colleciton view.

Does that work?