Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Function in Logo field (Oracle 10g,Win 7 32 bit,Apex 4.0)
Function in Logo field [message #623639] Fri, 12 September 2014 04:54 Go to next message
Xandot
Messages: 235
Registered: January 2014
Location: India
Senior Member
Hello,

Can i use function in logo field if yes then what is the format?



Thanks,
Xandot


Re: Function in Logo field [message #623724 is a reply to message #623639] Sat, 13 September 2014 04:37 Go to previous messageGo to next message
Littlefoot
Messages: 21580
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't think that you can use a function there; Apex expects image name (with a path to it), not a function.

However, have a look at Tom's answer here.


As I had to change logo depending on user's department, here's what I did: I created a region (position 07) located on Page 0. That region contains a single item (I named it "P0_LOGO"):
- Display as: Display image
- Based on: Image URL stored in Page Item Value
- Source used: Always, replacing any existing value in session state
- Source type: PL/SQL function body
- Source value or expression: return f_logo;

F_LOGO is a function that returns image name. Here's how I do it:
   FUNCTION f_logo
      RETURN VARCHAR2
   IS
      retval   VARCHAR2 (100);
   BEGIN
      SELECT pkg_general.c_worksp_img || c.logo
        INTO retval
        FROM context_setup c
       WHERE c.dept = f_operater_dept (v ('APP_USER'));

      RETURN (retval);
  END f_logo;

PKG_GENERAL's constant
c_worksp_img                  constant varchar2(200) := v('WORKSPACE_IMAGES');

CONTEXT_SETUP table contains one record per department; its C_LOGO column contains image name for each department, such as
context_setup.c_logo = 'DEPT_1.JPG'

Function F_OPERATER_DEPT returns user's department (so that I'd know which image to select).

The function returns
SQL> select f_logo from dual;

F_LOGO
--------------------------------------------------------------------------------
wwv_flow_file_mgr.get_file?p_security_group_id=0&p_fname=DEPT_1.JPG

SQL>


The final result: an appropriate logo image is displayed on the screen.
Re: Function in Logo field [message #623834 is a reply to message #623724] Mon, 15 September 2014 05:10 Go to previous message
Xandot
Messages: 235
Registered: January 2014
Location: India
Senior Member
Thanks Littlefoot for sharing information.
Previous Topic: APEX interactive report filters
Next Topic: Dynamically Change Datatype
Goto Forum:
  


Current Time: Fri Aug 14 21:29:07 CDT 2020