4

I am currently working in Oracle APEX version 5.1.2. I have created an interactive grid in my application that queries data from a table stored in the Oracle database. The data being queried is just several different URLs that refer to different pages in my application. So in other words, in each cell of one of the columns in the interactive grid there is a URL.

Then on a different page in the same application, I have created an interactive report that queries all of the data from the interactive grid. One of the columns in that interactive report is set to type "Link" and the link attribute is set to #LINK#. So each cell in that column contains a hyperlink for one of the URLs stored in the interactive grid.

The problem is that when I click on the hyperlink, I lose my session state and and am redirected to the login page. When I do then login, I am directed to the page in the application that the link was supposed to direct me to. The link only works if I hard code my current session ID in the URL in the database. But I'm trying to find a suitable substitution string for the session ID so that I don't have to hard code the session ID. I have tried the substitution strings &SESSION. and :APP_SESSION and &APP_SESSION. and V('SESSION') and nothing has worked.

Does anyone have any ideas of how to achieve this so that I don't lose my session state?

Thank you in advance.

Update:

enter image description here

enter image description here

Katherine Reed
  • 301
  • 1
  • 7
  • 20

1 Answers1

3

Apparently there is no problem with the url formed.

Could you inspect the element and display the generated html on the page?

I think you should not fill in the "link attributes" field, it should be blank. Click "Target" and there put the value #LINK# in the "URL" field. enter image description here

enter image description here

romeuBraga
  • 2,135
  • 1
  • 8
  • 20
  • In chrome, right-click on the link; then goes on to inspect element; it will show the html of the link. – romeuBraga Mar 07 '18 at 21:34
  • We can see the problem now, for some reason it is not replacing "& SESSION." by the session number. You can try the following: 1 - Do not store &SESSION. in the database. 2 - in your interactive report select, concatenate your database URL with session like this: SELECT myUrl || ':' || '&SESSION.' as URL FROM ... – romeuBraga Mar 07 '18 at 21:57
  • Thank you for the advice. I have just left work for the day and I don't take my computer home with me, but I will try what you are saying first thing in the morning and let you know how it goes. Thank you. – Katherine Reed Mar 07 '18 at 22:03
  • Ok, good luck. You can store your URL in the database only like this: "f?p=145797:8:" and in your select do only this SELECT myUrl || '&SESSION.' – romeuBraga Mar 07 '18 at 22:14
  • That's what I tried yesterday on apex.oracle.com. Didn't work either :( OK, let's see what Katherine says. – Littlefoot Mar 08 '18 at 07:07
  • @romeuBraga I posted new pics above in my original post after I implemented your recommendations. Please let me know if I followed your instructions incorrectly. When I click the hyperlink now nothing happens – Katherine Reed Mar 08 '18 at 14:40
  • That's right, however, you've renamed the column that stores a URL from "# LINK #" to "# URL #", so on the target you need to refresh the field. – romeuBraga Mar 08 '18 at 15:36
  • @romeuBraga Actually now that I look at it, it doesn't work the way it was supposed to. The link on my "Links" page is http://###.##.#.##:####/ords/f?p=60003:21: (page 21) but I mistakenly wrote f?p=60003:4: (page 4) in my query, so my query isn't actually connected to the URL in the interactive grid where the URLs are stored. I want it so that if I update the link in that interactive grid it automatically updates the link in the interactive report. I'm hoping that's possible. – Katherine Reed Mar 08 '18 at 16:03
  • Can you post the select of your report? And if the link is working, you can remove the previous images. – romeuBraga Mar 08 '18 at 16:04
  • @romeuBraga I updated the photos. The first photo is of the URL in my interactive grid, and this interactive grid queries the table in the Oracle Database. The second photo is of the select statement for the interactive report, which is where I want the hyperlink to be. – Katherine Reed Mar 08 '18 at 16:08
  • Okay, one of my instructions confused you I think. You need to fetch the value from the database and not write directly to your select. What I said is that your interactive grid does not need to have the full path of the link "https://apex.oracle.com/pls/apex/f?p=60003:21:" just save it like this "f?p=60003:21:". But in your report you can not type SELECT 'f?p=60003: 21:' || '&SESSION. you need to fetch the value from the table in the database something like SELECT myUrlFromGridTable || '&SESSION. Did you undersand? Do you have any question how to do this? – romeuBraga Mar 08 '18 at 16:19
  • Do I literally write "myUrlFromGridTable" in my SELECT statement or do I replace that with something else? I guess I don't know what value from the table in the database I am supposed to be fetching if not the value "f?p=60003:21:" – Katherine Reed Mar 08 '18 at 16:22
  • Does the report page and the interactive grid page use the same table in select? if so what is the name of the column that stores the link? – romeuBraga Mar 08 '18 at 16:25
  • What was the original select (on report page) when you started this post? – romeuBraga Mar 08 '18 at 16:34
  • Originally when I started this post, the query for the interactive grid (which queried a table I created in the database that just contains URLs) was and still is SELECT "ROWID", "VIEWLEVEL", "CAT1", "CAT2", "CAT3", "RANK", "LINK", "NAME" from "#OWNER#"."LINKS" And the query for the interactive report was SELECT * from "LINKS" WHERE "VIEWLEVEL" = 'Training' ORDER BY "RANK" DESC - I have changed the 2nd query a bit just for our conversation, but that was the original query – Katherine Reed Mar 08 '18 at 16:44
  • OK, then update the select on report page to: SELECT link || :APP_SESSION as URL from "LINKS" WHERE "VIEWLEVEL" = 'Training' ORDER BY "RANK" DESC – romeuBraga Mar 08 '18 at 17:07
  • YOU ARE AMAZING. It works perfectly. Thank you for your patience and all of your help. – Katherine Reed Mar 08 '18 at 17:40
  • I upvoted your original answer, but I got a response that my vote was recorded but cannot be displayed on this page because my reputation is too low. But I wanted to make sure that you know that your answer was upvoted. Thank you again!! – Katherine Reed Mar 08 '18 at 17:42