Most applications need some sort of "configuration" table. A simple key-value store where you can put values that might change on a different environment, like URLs, minimal password length, API keys, etc. And very conveniently APEX has this implemented as " Application Settings ": A simple table containing a key and a value - and a few other properties like "valid values". In your code you can reference these values using either the apex_application_settings view - that contains all Application Settings in your Workspace - or the apex_app_setting API - that you can use to get or set a value based on the Application Settings Name. That's all great. Until I ran into this situation: Our "application" consists of 2 APEX applications, one Internal (INT), backoffice kind of application and one external (EXT) facing one. And now I needed to set the Application Setting of the EXT application from the INT application. While I can see the current va...
If you run your APEX application - like a Form based on the EMP table - and test if you can change the value of Department to something else then the standard values of 10, 20, 30 or 40, you'll get a nice error message like this: But it isn't really nice, is it? So what do a lot of developers do? They create a validation (just) in order to show a nicer, better worded, error message like "This is not a valid department". And what you then just did is writing code twice : Once in the database as a (foreign key) check constraint and once as a sql statement in your validation. And we all know : writing code twice is usually not a good idea - and executing the same query twice is not enhancing your performance! So how can we transform that ugly error message into something nice? By combining two APEX features: the Error Handling Function and the Text Messages! Start with copying the example of an Error Handling Function from the APEX documentation. Create this function ...