OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to correctly interpolate a variable in a JavaScript template literal for a URL in Oracle APEX?

  • Thread starter Thread starter Shahroz Ahmed
  • Start date Start date
S

Shahroz Ahmed

Guest
I’m trying to construct a URL in Oracle APEX JavaScript using a template literal, but I’m running into an issue where the variable isn’t being interpolated correctly. Instead of getting the expected URL, the variable name is becoming weired.

Here’s what I’m doing: In Execute when Page Loads Section:

Code:
const test = `url("f?p=&APP_ID.:1:&APP_SESSION.:APPLICATION_PROCESS=GETIMAGE:NO::IMAGE_ID:1745")`;
console.log(test);

For this I get the working URL as following:

Code:
url("/ords/r/pj/employee-self-service-portal/home?image_id=1745&request=APPLICATION_PROCESS%3DGETIMAGE&session=890152562441&cs=12Y_buvBPIPUg6fQgAiURQM6QvOyCwIKjlcewXmOTiJMfdOkwT0QubRWuzmRHaSAuwXBtH4iDjQl1YMNWm72OXw")

But know I want to use a variable instead of Hardcoded 1745 For example:

Code:
const imageId = 1745;
const test = `url("f?p=&APP_ID.:1:&APP_SESSION.:APPLICATION_PROCESS=GETIMAGE:NO::IMAGE_ID:${1745}")`;
console.log(test);

This results in:

Code:
url("/ords/r/pj/employee-self-service-portal/home?image_id=%24%7BimageId%7D&request=APPLICATION_PROCESS%3DGETIMAGE&session=890152562441&cs=1dtlavkb6EP2nlZk9_KxMOcV6GSGzUTtKOAYodnsYe-DshAwwwSIr-pVAqpEb82XGSIHELUFeWMdJxKc5LrrAJQ")

The Variable is not Set

Note: It is a part of a bigger code in my Oracle APEX App. I want to create an Organization chart. Created an Application Process of GETIMAGE.

Looking Forward for responses.

<p>I’m trying to construct a URL in Oracle APEX JavaScript using a template literal, but I’m running into an issue where the variable isn’t being interpolated correctly. Instead of getting the expected URL, the variable name is becoming weired.</p>
<p>Here’s what I’m doing:
In Execute when Page Loads Section:</p>
<pre><code>const test = `url("f?p=&APP_ID.:1:&APP_SESSION.:APPLICATION_PROCESS=GETIMAGE:NO::IMAGE_ID:1745")`;
console.log(test);
</code></pre>
<p>For this I get the working URL as following:</p>
<pre><code>url("/ords/r/pj/employee-self-service-portal/home?image_id=1745&request=APPLICATION_PROCESS%3DGETIMAGE&session=890152562441&cs=12Y_buvBPIPUg6fQgAiURQM6QvOyCwIKjlcewXmOTiJMfdOkwT0QubRWuzmRHaSAuwXBtH4iDjQl1YMNWm72OXw")
</code></pre>
<p>But know I want to use a variable instead of Hardcoded 1745
For example:</p>
<pre><code>const imageId = 1745;
const test = `url("f?p=&APP_ID.:1:&APP_SESSION.:APPLICATION_PROCESS=GETIMAGE:NO::IMAGE_ID:${1745}")`;
console.log(test);
</code></pre>
<p>This results in:</p>
<pre><code>url("/ords/r/pj/employee-self-service-portal/home?image_id=%24%7BimageId%7D&request=APPLICATION_PROCESS%3DGETIMAGE&session=890152562441&cs=1dtlavkb6EP2nlZk9_KxMOcV6GSGzUTtKOAYodnsYe-DshAwwwSIr-pVAqpEb82XGSIHELUFeWMdJxKc5LrrAJQ")
</code></pre>
<p>The Variable is not Set</p>
<p>Note:
It is a part of a bigger code in my Oracle APEX App. I want to create an Organization chart.
Created an Application Process of GETIMAGE.</p>
<p>Looking Forward for responses.</p>
 

Latest posts

Top