Reputation: 1
I am trying to write an SQL query in Oracle Apex that accesses items in the page and then creates a graph based on that item. In this case, I want to display the last 5 games of a player that the user inputs.
I have tried using v('P2_PLAYER')
and :P2_PLAYER
to access the item value, but it still does not work; my graph returns no data.
Here is the code I am using currently (it works when I simply put PLAYER = 'Caitlin Clark'
, or any player in the database rather than PLAYER = :P2_PLAYER
)
Upvotes: 0
Views: 57
Reputation: 18630
What is the flow ? Without specifying how you want the page to work - what is rendered, what the user is doing and what the expected behaviour is - this question is impossible to answer.
So I'm assuming...that the page is rendered and then the user selects a value for P2_PLAYER. In that case you would create an on-change dynamic action on P2_PLAYER that refreshes the "region that creates the graph". Make sure to enter P2_PLAYER in the "items to submit" attribute of that region to ensure the current session state of the items in taken into account when the region is rendered. If this doesn't work provide more info.
Upvotes: 0
Reputation: 142705
P2_PLAYER
looks like a select list item. If that's so, usually its query looks like
select player_name as display_value,
player_id as return_value
from players
order by player_name
which means that
Caitlin Clark
, but7369
(Caitlin's ID)So, if your graph query works OK when you use her name in where
clause:
where player = :P2_PLAYER
then
ID
(instead of a name)Certainly, as you didn't share info that might be relevant for this problem, what I wrote is just a guess based on what we usually do. See if it helps. If not, edit the question and provide some more details.
Upvotes: 2