I have a table with uniform data but distinct foreign keys per project. I've developed a separate entity containing the data for updating the existing one via a button click. How can I implement this in OutSystems? (I'm a beginner so it may be really easy but I need your help)
Table where I want to import data: site
Table where I want to import data from: site_autofill. From this entity (which has attribute id, class and code) i want to export only class and code. Attribute "Area" in site table must remain empty.
Entities relationship:
I have tried to add a button with the following screen action, but I don't know if this is the correct way to do it:
Thanks in advance, if the information are not enough or unclear please don't hesitate to tell me.
I think that the button should not have any site structure. instead, this should be the form?
or may i know what is the 1st screen looks like? or what the inputs/dropdown the user will select before clicking save/button
I'll just attach the OML here and I also made some modifications, if the project name only + save button will reflect on user interface
Hi,
You need to add foreach loop aggregate to finish inside the cycle and insert data into the entity.
if still not clear send me OML so i can do.
Thanks
CV
Hi @Stuart Neal
I think you can achieve it using only assign+fetch, but if i understand correctly you just need the default data from auto fill table then save it on the site table?
if this is your goal maybe this will work.
1st you need the auto fill fetch record (to get the default values)
2nd need the CreateOrUpdateSite source record (can do struct/agregate to update specific record)
3rd assign the values of CreateOrUpdateSite source record from auto fill which is ClassId and CodeId
4th then call the CreateOrUpdateSite
----------------this will create/update a record on you site
with ClassId and CodeId = site auto fill
Area and ProjectId = depend on the record or the user selection
also if you want to get all the ClassId and CodeId from the auto-fill table you will need a for each(loop in auto-fill table) to create multiple records on your site with the same project and area but different class/code (depending on auto-fill tbl record)
@sherwin I followed the suggestion you gave me in the second image, to import all records. One question, while I am configuring the button settings, can you show me which input did you put here?
Since we create a new input variable in the action, I don't have clear what to insert in this field.
My most sincere thanks, I managed to adapt your method to my framework.
Since I'm a beginner I am still not really familiar with the concept of screen actions and logic, but the explanation you provided me was truly helpful.