Editing database using forms


So i have a situation at hand. So, for example in my database, i have an entity of "item", with attributes "Min length", "Max length" and "ClassificationId". I also have another static entity of "classification" with attribute of "classification" (with records of small and big).

In the form, there are inputs for classifications (Dropdown), min length and max length. I made the form such that min length will only be visible when a "small" is chosen in the dropdown. 

The issue is that when i am editing a saved item (in the edit item form), i want to be able to change the classification of the item. But when i want to change an item's classification from "small" to "big", the input for min length will no longer be visible (which is what i wanted), but the saved min length (from the pre-edited item) will still be in the database (which is not what i wanted). Is there a way where i can delete the data for min length when i change the classification from "small" to "big"? 

Hi Jolene,

Given those are business rules, you will have to implement them yourself: if classification is "big" then assign the default value to min-length.

My suggestion is you do it in a public wrapper action (and make your entity read-only), so that no matter where you create/update your entity records those business rules are still enforced and you have a guarantee data on the database is correct.

For more info on Wrapper Actions, you can check this series of articles on Wrapper Actions by one of OutSystems MVPs: Basics, Laying the Foundations, Checklist, Saving data, Removing data (around 20 minutes read in total, but well worth it!)

Hope this helps!