On Button click insert into another table

Hi,

I have a Customer table, Item table and an Order. Item table is a third party table, Order refer to it. Order has a foregin key in it or what :D. And on Customer’s browser screen when the user selected at least one row (multiple select enabled) and clicked myNewInsert button, then it should insert new datas into Order table with some data from the browser screen selected rows.

Sorry for my bad english.
I have no idea how to do it. Now I check that on button click, how any row has selected.
First, I thought that, if a row selected and button clicked, write out one column’s data, but I don’t know how to get data from getSelected(), I don’t know what its return type. I have read the documentation, but it isn’t mentioned.
Here is what I got:


public void onMyNewInsertBtn(Component source) {
        Customer customer = customersTable.getSingleSelected();

        String message = String.format("Customer %s %s was selected", customer.getItems(), customer.getName());
        showNotification(message);
    }

Thank you, for reply.

Hi Szabó,

I recommend creating a service (see Midlleware tab in Studio) with a method that will accept the list of selected Customers and create other entities using their data. The Data Manipulation project contains examples of programmatic creation of entities. You can also open this project right from Studio, see the Samples tab.