Detect if an entity has logic exclusion

Hi people,

We are just talking about the patterns around logic and physical exclusion of records and some thinks emerged.

My  question is about the automatic detection on generic CRUD wrapper action template about an entity having a IS_active_Attribute defined when on screen properties of entity on the "More options" the value none/nothing selected about this column.

I found some records on entity table having null values, many others having NULL and others an generated value.

How is the value checked during Delete operations by generated CRUD Actions?

The correct value to represent an entity without logic exclusion/Active/Inactive feature is to check for null, for an valid value, for an empty string value?

Are there other way to do this? If I want to generate final code(CRUD Wrappers) without adapt it to each entity without to create a cached record about the entities my system have, with some time set OnPublish of modules containing entities?

Regards,

Hi Márcio,

I'm not sure I understood all of that - what exactly do you mean by "logic exclusion" in an Entity?

You mention the Is Active attribute inside the Entity properties, but from my understanding, that field is only an accelerator: whenever you drag that Entity to the screen, if you have an Is Active attribute defined, OutSystems will create a filter of it set to True - it has no bearing on the generated CRUD actions.

Solution
Hi Afonso,

We have choose to use the default Is_Active attribute to control the logic exclusion on entities that are not defined to have physical exclusion.

On the default CRUD Wrappers that we have made on the first version we put some reminders on code to when the dev used it combined with some screen templates they have to make some manual adjusts depending on the final entity their will be using in that CRUD screens.

My goal is to have the fewest adjust point to accelerate the use of screen templates with CRUD wrappers.

I have completed the implementation just now and can achieve the desired flexibility.

We have two actions like Justin James from "Application Framework", one like Entity_Can_Exclude and other Entity_Exclude.

I achieve a way to search on database on Entity x Entity_attr x Space and Know if that entity was set or not to have an _s_active attribute (our pattern for logical exclusion) and drive the delete action or update the entity with basic audit, and setting Is_active of false.


My question was about the stability of Is_Active_Attribute of entity to know if it had the Is_active attribute set. As the column has a mix of SS_KEY of Entity_attr, NULLS and empty values.

I end up- with a single point of adjust on the entity update to define the value of a column I extracted in entity table, because I can't do a assign to a attribute by it's string name. If someone know how let me know.


To not receive an entity name as magic string I made an extension receiving an object that I can inspect via reflection on the extension. No magic strings!


This time i will work with a small cache time and in near future a timer set to OnPublish to update a central cache, as it solves the hard magic strings problem.


Thanks for your interest.




Solution