MOUG17: How to Build Multi-Client APEX Applications
How to build Multi-Client APEX Applications
Reduce the number of applications and schemas required to serve clients with
similar needs but different data while maintaining privacy and personalization.
By Tony Jedlinski President Konoso LLC
President - Konoso LLC
Vice President - MOUG
Former Executive VP, Director Web Content and Initiatives - IOUG
•Recognized by Oracle Magazine as a leading expert in Oracle Application Express (ApEx) development
(named HTML-DB Developer of the year – 2005).
•Published ApEx author (Oracle Magazine May/Jun 2006), (IOUG SELECT Journal Q4 2005).
•ApEx presenter (Oracle World 2004, 2006, 7), (IOUG Live! 2004,5), (Collaborate 2006,7,8,9,10,11).
•More than 25 of years experience as an Oracle systems architect / developer, and 35 years of
experience in system analysis and development.
Sometimes multiple users have the basically
same needs but require some
customization, for example Oracle User
When working on a tight budget,
you may not have the luxury of
separate schemas for each client,
rather you may need to have
multiple clients share the same
tables and other objects.
Having everyone sharing the same
application and underlying data
structure can reduce support and
maintenance cost and time.
Customization is still possible using these techniques
• Automatically selected theme roller themes
• Option settings
• Saved settings (e.g. logo file location) in database
• Custom Dictionary Values
• Use application level variables to substitute variable text e.g.
• Determine at what level(s) you will customize (e.g. Organization)
• Add a foreign key column to the USER dictionary to identify which
Organization the user belongs to.
• Use this same technique for other tables such as dictionaries
ACP_MHBS table defines the Organizations
Each user is associated with a particular Organization and given appropriate
privileges and personality
Set application level fields to easily reference the User’s Organization
Do not allow these fields to be set from the browser .
Re-calculate them on every page display so that any
setting changes are reflected immediately.
Now report queries etc. can be limited to just the rows of the current user’s
Changing Theme Roller settings dynamically
• Based on current user
• Based on current user’s affiliation (e.g. Organization)
• Any other entity in the database
Define several themes using theme roller
Associate each Organization with a Style
Create an Application Process: Set Style On Load
PL/SQL Procedure holds
The code to manipulate styles is in
the APEX_THEME package provided
Look up the current style and the
desired style tor the user’s
If they are different, set to the desired
Complexity is within the function HAS_OPTION
CREATE OR REPLACE FUNCTION has_option (acp_mhb_num_in IN
PLS_INTEGER, option_code_in IN VARCHAR2)
WHERE code = UPPER (option_code_in);
result_v VARCHAR2 (1) := 'N';
FOR o_rec IN o_cur
IF INSTR (':' || o_rec.acp_mhb_nums || ':', ':' ||
TRIM (TO_CHAR (acp_mhb_num_in)) || ':') > 0
result_v := 'Y';
Look up the Organization(s) who have this
If the current Organization is included,
return Y else return N
Add this authorization to the appropriate page element(s),
in this case the entire EMP page and it’s navigation bar entry.