Discussions
Categories
- 385.5K All Categories
- 5.1K Data
- 2.5K Big Data Appliance
- 2.5K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 585 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 46 Data Integration
- 46 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 667 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
Possible to Re-Fire a Application Computation On Demand?

APEX 4.2.5.00.08
I have an Application Computation that sets the value of an Application Item using the current APP_USER as one of its required parameters. This computation fires On New Instance so; it is fired when the login page is loaded. However, the login page, bu definition, is loaded before the user has logged in as so; the APP_USER, at this point is still set to "nobody"
I know that I can change the computation to fire for every page but, this is really unnecessary. I merely want to fire it, once, following a successful login (which would then set the APP_USER).
Is this possible? (From JavaScript or PL/SQL)
Thanks,
-Joe
Best Answer
-
Hi Joe,
It's not really a work around, it's how you set up item values based on the user logged in.
Put common code in a package, call it from multiple locations within APEX.
I didn't say computations were only for page items, I said "page level" computations. Calculate application/page items at some point during the render of each page. These computations can be set to calculate only for certain pages, events, requests etc.
Application computations allow these calculations to occur at this frequency.
If you only want something calculated once, you add a declarative condition that tests for null. But if it's only calculated once, when should it be calculated? If not required for login page, say where page not = 101, but I would again question the timing - should it be an application computation?
APEX_PUBLIC_USER is not really a glitch, it's a catalyst. Your parsing schema is the gateway to the database, so make sure that's as lean as it needs to be. Not all applications require login before anything happens.
Scott
Answers
-
You need to fire this computation on post-authentication, within your authentication scheme.
-
Scott,
Thanks, for answering.
I do see that there is a slot for "Post-Authentication Procedure Name" in the Authentication Scheme page. However, I am still unclear, specifically, how to invoke it (from there or anywhere else).
I have an application item named IS_USER_READ_ONLY. I then have an application computation defined for this item of type PL/SQL Function Body.
How, exactly, do I call it? I mean what would be the syntax to do so?
-Joe
-
Often there will be syntax example by clicking on the attribute label.
Post-authentication is expecting a reference to a procedure, which can be defined inline within the authentication scheme, or exist within a package (or as a stand-alone procedure)
-
Right...I know how to invoke a Stored Procedure...or, for that matter, even an Application Process (as opposed to an Application Computation).
The question is, specifically, can a Computation be fired after login?
Thanks,
-Joe
-
You don't.
Until they put a 'post authentication' option in the 'fires on' attribute, Computations are not appropriate for this.
Put your calculation in a package and call that from post-authentication in your authentication scheme. Leave computations for page level calculations.
-
-
Scott,
Yes, I had long ago gotten around the problem by using a packaged procedure. So, your work around, for sure, does work. This thread was posted, specifically, because I just wanted to know if it was *possible* to re-fire an Application Computation. I get, now, that the answer is a flat No.
To your comment about using computations only for page items. I have to, most respectfully, disagree with you on this one. There is a reason that these were provided at the application level. That reason being that one wouldn't need to recalculate a value every single time a page was loaded when one knew that the value wouldn't change. That is, APEX provides the means to calculate a value once and, thereafter, to be able to access that value on every page.
While a "Fire On" attribute would, of course, be the most flexible way to approach this; simply providing a post or pre authentication flag would go a very long way. For one thing, it's always struck me as a bit of a security "glitch" that the APEX_PUBLIC_USER connects to the database and run all sorts of queries before we've established anything about the user. Moreover, almost none of these queries (computations) are actually needed to load the Login screen itself.
-Joe
-
Hi Joe,
It's not really a work around, it's how you set up item values based on the user logged in.
Put common code in a package, call it from multiple locations within APEX.
I didn't say computations were only for page items, I said "page level" computations. Calculate application/page items at some point during the render of each page. These computations can be set to calculate only for certain pages, events, requests etc.
Application computations allow these calculations to occur at this frequency.
If you only want something calculated once, you add a declarative condition that tests for null. But if it's only calculated once, when should it be calculated? If not required for login page, say where page not = 101, but I would again question the timing - should it be an application computation?
APEX_PUBLIC_USER is not really a glitch, it's a catalyst. Your parsing schema is the gateway to the database, so make sure that's as lean as it needs to be. Not all applications require login before anything happens.
Scott