Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Fetch Variable in Stored in Table

Alter BoyAug 22 2018 — edited Aug 22 2018

Hi,

So I have a Table, not going to go into too much detail about it because it is fairly irrelevant. All that needs to be known is there is a Varchar2 column, Content, that I intend to be displayed in a text area. So for example, the text may read "My name is Matthew" except I want it to read "Matthew" off of the page that I'm displaying it. Let's say I have a Page with two page items and that's it. The first page item, P129_NAME, holds the value 'Matthew'. The second page item calls Content from the Table. I tried to put, in my Content, "My name is :P129_NAME" so that whoever's name is in that Page Item at that time will be displayed in the Text Area. However, when called it literally displays ":P129_NAME" instead of "Matthew". I also tried &P129_NAME. and the same thing happens. Is there a work-around this?

Thanks,

Matthew

This post has been answered by fac586 on Aug 22 2018
Jump to Answer

Comments

fac586

Alter Boy wrote:

So I have a Table, not going to go into too much detail about it because it is fairly irrelevant. All that needs to be known is there is a Varchar2 column, Content, that I intend to be displayed in a text area. So for example, the text may read "My name is Matthew" except I want it to read "Matthew" off of the page that I'm displaying it. Let's say I have a Page with two page items and that's it. The first page item, P129_NAME, holds the value 'Matthew'. The second page item calls Content from the Table. I tried to put, in my Content, "My name is :P129_NAME" so that whoever's name is in that Page Item at that time will be displayed in the Text Area. However, when called it literally displays ":P129_NAME" instead of "Matthew". I also tried &P129_NAME. and the same thing happens. Is there a work-around this?

The apex_plugin_util.replace_substitutions API method can be used to replace &SUBSTITUTION_STRINGS. in string parameters. This exists to support the creation of APEX plug-ins, which does not appear to be related to the proposed use case. It seems to involve creating dependencies between data and the application in violation of the principle of separation of concerns.

Why would you need to do this? What problem are you really trying to solve?

Alter Boy

I need to do this because the name won't always be "Matthew". It can be any name as there are many possible names in the Table, so I want the text area to have the person's name that is currently being displayed in the page item.

Alter Boy

tab.PNGdisplay.PNG

fac586
Answer

Alter Boy wrote:

I need to do this because the name won't always be "Matthew". It can be any name as there are many possible names in the Table

It's also the case that it might be desirable to have mail templates that might not always be utilized by an application where there is a P129_EMPLOYEE item, or a session where this has a value in session state. Also, how does the user creating or maintaining the template know that P129_EMPLOYEE is the magic item?

A more flexible implementation would be to use generic placeholders in the template text:

For your information there is a new member of staff by the name of %s joining our team

The application can then use apex_string.format to substitute the placeholder using whatever value is required in the current context:

apex_string.format(:p129_mail_template, p129_employee)

so I want the text area to have the person's name that is currently being displayed in the page item.

Where does that value come from?

Marked as Answer by Alter Boy · Sep 27 2020
Franck N

Hi,

the Question is ?

Are you sure the Item :P129_NAME displays the value "Mathiew"?

how are you fetching  the value form the DB and store it into the Item ?

-     Set that item to display only and check the Ouput of it on your Page.

-     Or use apex.item('P129_NAME').getValue(); in your console to check the Value.

if nothing is getting displayed then there lies the issue.

regards,

Franck

Alter Boy

The apex_string.format function is all I needed thank you.

1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 19 2018
Added on Aug 22 2018
6 comments
286 views