This content has been marked as final. Show 7 replies
That is because the SQL is parsed first, along with substitution strings. The results are not parsed. If you want to substitute in your procedure, you could always pass a substition string in as a parameter, and then parse the to-be-returned text yourself.
garcol wrote:Is this Classic report or IR?
Why is this working:
and this not:
case when function1( p1, p2 ) = 'N' then '<img src="#APP_IMAGES#1.jpg" title="1">' else '<img src="#APP_IMAGES#2.jpg" title="1">' end nv
Function1 returns Y or N, Function2 returns the same img-tag as in the 'case when' (<img src="#APP_IMAGES#1.jpg" title="1">). The first statement shows the image correct, the 2nd way does not show the image (red cross).
function2( p1, p2 ) images
Report columns are 'Standard report column', when I change that to 'Display as text', I see the right img-tag.
Does anyone know why this is not working?
Edited by: garcol on Feb 22, 2013 10:48 AM
In classic report, The best way to do this is change the function to just return the name of image i.e. 1.jpg
And in the report column attributes add a derived column with Display As set to Standard Report Column and in HTML expression add <img src="#IMAGES#"/>
OK. It's an interactive report by the way...
But I wanted to use the function to return more than one image-tag. It will be a list of images, that's why I want to use a function, the list of images is dynamic, so:
<img src="#APP_IMAGES#1.jpg" title="1"> <img src="#APP_IMAGES#2.jpg" title="2">
Edited by: garcol on Feb 22, 2013 11:27 AM
But I wanted to use a function because I want to show more than one image. The function will return a couple of <img-tags>, so:
<img src="#APP_IMAGES#1.jpg" title="1"> <img src="#APP_IMAGES#2.jpg" title="2"> <img src="#APP_IMAGES#5.jpg" title="5">
@Tom, I think I do not understand your comment...
As Tom already mentioned, you have to pass the #APP_IMAGES# as parameter to the function21 person found this helpful
// call it as function2( p1, p2,'#APP_IMAGES#') images
Exactly as VC showed, that is what i meant. Pass in an extra parameter.1 person found this helpful
For example, this function
And suppose this is the sql
CREATE OR REPLACE FUNCTION get_images ( p1 IN VARCHAR2, p2 IN VARCHAR2, p_app_images IN VARCHAR2 ) RETURN VARCHAR2 IS lImageList VARCHAR2(2000); BEGIN FOR i IN 1..5 LOOP lImageList := lImageList || '<img src="' || p_app_images || i || '.jpg" alt="' || i || '" >'; END LOOP; RETURN lImageList; END;
When apex parses the SQL, it will substitute #APP_IMAGES#, and would result in your function being called with the correct value.
SELECT get_images('param1', 'param2', '#APP_IMAGES#') FROM DUAL
For example, it would run this after substituting:
SELECT get_images('param1', 'param2', '98484C84E98468C464E894C984A47B867') FROM DUAL
Thanks, that's exactly what I have made now!