Hello again Outsystems Community:

I've been struggling to insert data into a Database.
I've created a form and I have 2 tables.

Table A:

Have some toys, like a car, a truck
Table B have an ID and a foreign key that points to the ID of the Table A.

My main issue is that I have a List Record with all the data that I want to insert into the Table B, which I can separate the data through substr.

But I'm not sure how I can insert any valid data into the foreign key of the Table B.


Let's imagine table A contains this:

ID1 - Car
ID2 - Truck
ID3 - Van

On table B the foreign key references the ID of the Table 1

And I want to insert on that foreign something that selects for example the car.
I've tried to insert on table B foreign key the number of the ID, the name, but nothing seems to work, so far.

Thank you a lot for the help so far.


could you provide a sample oml?

What you need to insert is the Id from Table A. What you have is the name because the id in A is probably an autonumber. So you need to search in A by name and return the Id. Do a function because you will use it a few times.

Sorry for this.
But I will change my way of dealing with this

Right now I just want to insert data from a ListRecord on the database

I don't need it to be all the data (I can separate it with substr to a variable if necessary later)
But I want to insert some of the values into my database.

Like I said my database contains the following tables:

(I'm going to use generic names since it's confidential)

Table  A:





Table B:


-Table AId


Atribute Table AId references the ID of Table A.

What I exactly want to do right now is to insert some of the data from a variable or a List Record into this entity, I mean populate them without any form like I initially intended at the beginning of this thread.

Can I use the "Insert Into" in the SQL widget?


As long as you cannot provide a simple oml it's pretty hard to understand what you are exactly struggling with.

That said, it is indeed possible to create records from a list.

for-each loop

- assign tableArecord values

- create TableARecord

-assign tableBrecord values

- assign tableBRecord-tableAId to CreateTableARecord.id

- create TableBRecord


you can do it with an advance query as well, but you still need to have the lookup of tableA for the id..


@J. Thank you.