How can I select an item from the editorial type list so that it can modify my type_redaction_id?

0
In Mendix, I have an entity "Article" and another "TypeRedaction", both having a "many to one" relationship ("many" side for "TypeRedaction" and "one" side for "Article"). So in my "Article" entity I have a foreign key from the "TypeRedaction" table named "type_redaction_id". In my interface, I display the article with its name and its "type_redaction_id", and next to the "type_redaction_id" text box, I have an "Edit" button which allows me to modify the "type_redaction_id" of 'an article. When I click on this "Edit" button, a pop-up appears, showing me the identifiers of the existing redaction types in the "TypeRedaction" table in my database. I want when I click on one of the editorial types displayed, it will change the initial "type_redaction_id". Here is my SQL query: UPDATE referentiel.articles SET type_redaction_id={id} WHERE code={code} How can I select an item from my list type list so that it can modify my "type_redaction_id"?
asked
4 answers
0

Hi Zaineb,

Since Mendix already takes care of the foreign keys for you in the background, you will need to add custom logic to maintain the extra foreign key in the Article entity. You can create a microflow that gets triggered on the "on-change" event when you edit/change the TypeRedaction association. This microflow will have a change object activity that will update your Article's type_redaction_id attribute with the the foreign id of your newly selected TypeRedaction.

Additionally, take a look at the reference selector widget which allows you to pick which object you want to change the association to using a dropdown. https://docs.mendix.com/refguide/reference-selector/

answered
0

4.PNG

hi hyder ,

thank you for your answer

i did what you mentioned but in my internal data base it creactes me two lignes one  article with values null but with my new expresion typ-redaction_id and the second ligne is the article with the initial values but for my case i want just modify my article 

answered
0

You will have to remove the unwanted association by changing the "Type" below from "Set" to "Remove"image.png

answered
0

image.pngit add new articles he didn't modify type_redaction_id when i checket one of the id of the table TypeRedaction

 

answered