update records based on selection

update records based on selection

  

Hi all


staticentityX has records x1, x2, x3 (text) and b (boolean). The last is for being able to use a checkbox on a webscreen.


In a webscreen I use a ListRecordsTable to show the entityXrecords with checkboxes.

So far so good, it works. The records are shown with the checkbox beneath. I tested it and if I select (check) one ore more checkboxes the labels of the static entity records are shown on the screen (var in expresssion).


Q:

entityZ has attributes z1, z2, z3 (boolean)


How do I (screen action) write the selected records in ListRecordTable to entityZ ?

I tried using a var of Type Record with an assignment but cannot get it to work properly.


Regards, Harry

Hi Harry,

Can you share some more information? Screenshots and the oml would be great.

Regards,

António Pereira

Hi Antonio,


I 'solved' it (see the attached oml,  screenaction: SaveSelectedBMNRCats) but find it more or less a 'clumsy' way. If there would be a better solution?


Regards, Harry

Hi Harry,

I looked inside your oml and I think there is a better way (I don't understand your language but I think I got the idea :P ). 

Why don't you create an entity to have records of BMNR_Categorie Identifier and BMNRregistratie instead of having explicit attributes in the BMNRregistratie entity? That would reduce you clumsy way to a foreach connected to an entity action to create or update. Check the attached oml.

Does it make sense to you?

Regards,

António Pereira

António Pereira wrote:

Hi Harry,

I looked inside your oml and I think there is a better way (I don't understand your language but I think I got the idea :P ). 

Why don't you create an entity to have records of BMNR_Categorie Identifier and BMNRregistratie instead of having explicit attributes in the BMNRregistratie entity? That would reduce you clumsy way to a foreach connected to an entity action to create or update. Check the attached oml.

Does it make sense to you?

Regards,

António Pereira

Antonio,

I cannot follow exactly what you are doing here. In the screen I must show a few checkboxes (for each entry a row must be shown) and by iterating through that list I must update another tables attributes with true (if checked).  

Regards, Harry




Harry,

I noticed that you have an entity (BMNRregistratie) with 5 attributes and each one is a value of the static entity BMNR_Categorie. In the screen, you are listing all the values of this static entity and when you save you are updating the BMNRregistratie record. The 'clumsy' logic you have there is a consequence you have to deal since you must access to the right attribute of the BMNRregistratie to marked it as checked.

What I mean is, instead you could create a new table where each record has 2 attributes, a BMNR_Categorie Id and the Id of the other record you want to relate to the category. I don't know if there is any other use case for the BMNRregistratie entity, but if not then it can be deleted. 

In this way, your 'clumsy' logic won't be needed. if in the future you had another category to the BMNR_Categorie you won't need to change the logic to add a new Switch branch and the respective Assign and update the BMNRregistratie with a new attribute for the new category. 

These are just my 2 cents, evaluate if it makes sense for your project :)


Antonio,  

you maybe right. I have to study the oml to understand what you're doing. But when I run the example the BMNRregistratie_BMNR_Categorie entity contains no records after I click the save button.

Regards, Harry


Hi Harry,

I had some time to test and it is working in my example. The new entity I've created is being filled in with records based on the selected categories.


Regards,

António Pereira