Hi all,

     I have a question about static entity. I know that a record in a static entity doesn't have the update action, but is there a work around way to update a record in a static entity?

     My scenario is this : I have a list of records in a static entity. I need to show only a few records for a period of time. After some time I have to show another set of records. Can I manage this set of records through front end level.


Thanks,

Gowtham

Hi Gowtham,

Basically you cannot modify any static entity .If its possible you can add new column to that static entity and can implement your selection logic  else for it would be better to use normal entity for your scenario.


Hi Gowtham,

A Static Entity is, as the name implies static. That means you can't change it. It's like a constant value. Like Pranav wrote, it is common, if you need to select some records at a certain moment and some others at some other moment, to add an Attribute to the Static Entity you can query on. For example, if there's one record that's valid all day, another that's valid only in the morning, and another one only in the afternoon, you could add two Attributes "StartingTime" and "EndingTime", and use the current time in your query. The only downside to this is that when you have a Combo Box Widget that displays the records of the Static Entity, you can't directly specify the Static
Entity, but you need to perform a query first (most likely in the Preperation) and assign the output of the query to the Combo Box.

That said, if the content really changes a lot (today set X, tomorrow set Y, and so on) and there's no repetition, your data is not static at all, but very dynamic, and even wanting to use a Static Entity makes no sense at all. The advantage of Static Entities is that you can reference the records via the Entities.MyStaticEntity.Attribute construct, using them as a foreign key in other Entities. This wouldn't make sense if they aren't static (and it should also tell you why deleting records from them dynamically would break your code!).

Static entities are still in your database, you could still change them using SQL (if you have a user with write rights). Though this is not recommended, a static entity is a constant, it never changes value, or atleast there should never be the need to change.

If you still need the value to change, you have 2 options:

1) edit your static to fit the new values
2) change the static entity to a normal entity, with a maintenance screen to manually change the values on runtime.

Static entities cannot, and should not be changed! This is very bad advise Joey! They are likely used as foreign keys, so you'd get foreign key constraint violations anyway, and publishing their Module would overwrite any changes you made. Also, your application will break, as using a Static Entity record that does not exist in the data base leads to errors. So NEVER EVER do that!

Kilian Hekhuis wrote:

Static entities cannot, and should not be changed! This is very bad advise Joey! They are likely used as foreign keys, so you'd get foreign key constraint violations anyway, and publishing their Module would overwrite any changes you made. Also, your application will break, as using a Static Entity record that does not exist in the data base leads to errors. So NEVER EVER do that!


Totally agree !! 

Kilian Hekhuis wrote:

Static entities cannot, and should not be changed! This is very bad advise Joey! They are likely used as foreign keys, so you'd get foreign key constraint violations anyway, and publishing their Module would overwrite any changes you made. Also, your application will break, as using a Static Entity record that does not exist in the data base leads to errors. So NEVER EVER do that!


It wasn't actually advice (or atleast I wasn't suggesting to do it), like I said:
 "Though this is not recommended, a static entity is a constant, it never changes value, or atleast there should never be the need to change."

Sorry if it came across as actual advice, I was trying to lead to changing either the static to a normal entity or to change the values in the static in the development studio.