0
votes

The scenario:

I have an ApEx page which pulls a record from a table. The record contains an id, the name of the chart (actually a filename) and the code for an image map as an NVARCHAR2 column called image_map.

When I render the page I have an embedded HTML region which pulls the image in using the #WORKSPACE_IMAGES#&P19_IMAGE. substitution as the src for the image.

Each chart has hot spots (defined in the image_map html markup) which point to other charts on the same ApEx page. I need to embed the:

  • Application ID (like &APP_ID.)
  • Session (like &APP_SESSION.)

My problem:

When I try to load the &APP_ID as part of the source into the database it pre-parses it and plugs in the value for the ApEx development app (e.g. 4500) instead of the actual target application (118).

Any help would be greatly appreciated.

3

3 Answers

0
votes

Not a lot of feedback - guess I'm doing something atypical?

In case someone else is trying to do this, the workaround I ended up using was to have a javascript run and replace some custom replacement flags in the urls. The script is embedded in the template of the page and assigns the APEX magic fields to local variables, e.g.:

var my_app_id = '&APP_ID';

Not pretty, but it works...

0
votes

Ok - I think I've left this open long enough... In the event that anyone else is trying to (mis)use apex in a similar way, it seems like the "apex way" is to use dynamic actions (which seem stable from 4.1.x) and then you can do your dynamic replace from there rather than embedding js in the page(s) themselves.

This seems to be the most maintainable, so I'll mark this as the answer - but if someone else has a better idea, I'm open to education!

0
votes

I found it difficult to set a dynamic URL on a link to another page - directly - attempting to include the full URL as an individual link target doesn't work, at least in my simplistic world, I'm not an expert (as AJ said: any wisdom appreciated).

Instead, I set individual components of the url via the link, and a 'Before Header' PL/SQL process on the targeted page to combine the elements into a full url and assign it to the full url page-item:

APEX_UTIL.set_session_state(
  'PG_FULL_URL',
  'http...'||
     v('PG_URL_COMPONENT1')||
     v('PG_URL_COMPONENT2')||
  '..etc..'
);

...where PG_FULL_URL is an item of Type 'Display Image', 'Based On' 'Image URL stored in Page Item Value'.

This is Apex 5.1 btw, I don't know if some of these options are new in this release.