How to add data to one table from other

I have a table FoodPurchase. This table contains information like name, type, price, and quantity.

The type can be dairy and non-dairy. So I want to create a new table dairy, which will have fields like name, price, and quantity.

Whenever a user enters any dairy product, it will be automatically added to the dairy table.

I tried adding a query using Query Designer with criteria as type=‘dairy’
but I did not get any results.

I want to list all dairy products in a separate table. How can I do that?

Hi shweta,

You could do this by adding a function inside of Five and attaching it to the Do After Insert event on the FoodPurchase table.

Please use the link below to understand how to use a Do After Insert table event. Additionally the context provided to the function will have a new and old property which contains the data being inserted (Name, Price, Quantity) from your form.

For Example:

context.new.Name will have the name value from your form and as per the example below you can use Five’s executeQuery() function to add data to another table.

Table Event Issue (Do After Insert) - How do I? - Five Community Forums

executeQuery() | Five | Low-Code For Real Developers

executeQuery() | Five | Low-Code For Real Developers

Hello Jo-Anne,

Thank you for your help.