Question about oracle xe search query - sql

this is my second time using ORACLE xe and Apex. Here is what I'm trying to do .. I'm trying to execute the following query SELECT * FROM EMPLOYEES WHERE JOB_TITLE = 'CLERK'
but not from sql command prompt but from gui/apex and here is how- I have created page one with one textfield and one submit button.
Now of course I'd type in the text field value CLERK and I'd like onclick on submit button that I be taken to page2 let say, and on that page2 to receive argument for the query. The query will be located at page2 of course.
I believe that this is fairly simple for someone who knows oracle, I know of course how I'd do this with PHP/Mysql its simple as it can be all I need is this :
#1 Get value from input
#2 Pass it to the next page using javascript or whatever
#3 Execute query on the next page using the value passed in where
Thank you, explanation tips hints link .. anything is welcome

You can refer to any item in an Apex application from any other page. For example, on page 1 you have an item P1_JOB_TITLE, then on page 2 you write a query like:
SELECT * FROM EMPLOYEES WHERE JOB_TITLE = :P1_JOB_TITLE;
(warning: make sure that page 1 doesn't have a "reset" process which would clear the value of the item when the page is submitted)
Note, however, that the item doesn't have to be on a different page if you don't want it to - you could have it on the same page as the report.

Related

How to Select Choices input field having same class, type, Xpath everything is same

I have two input fields to enter choices which have same class, type. Id is different by it is dynamic and create on run time so i can't use id.I used indexing ,it's not working properly.
driver.findElement(By.xpath("//input[#type='text'][#placeholder='Provide a response entry that customers can select'][1]")).click();
driver.findElement(By.xpath("//input[#type='text'][#placeholder='Provide a response entry that customers can select'][1]")).sendKeys("Iphone 6");
driver.findElement(By.xpath("//input[#type='text'][#placeholder='Provide a response entry that customers can select'][2]")).click();
driver.findElement(By.xpath("//input[#type='text'][#placeholder='Provide a response entry that customers can select'][2]")).sendKeys("Iphone 7");
I used indexing in given image link.
click link to view code in organized way
Index 1 works in this case but unable to find index 2.
Given inspected html code is below of input field 1 and field 2
Field 1
Input field 1 image Xpath link
field 2
Input field 2 image link
If these two inputs are always in this sequence (so the first input is always first and second always second)
You can use:
driver.findElement(By.xpath("(//input[#type='text'][#placeholder='Provide a response entry that customers can select'])[1]")).click();
driver.findElement(By.xpath("(//input[#type='text'][#placeholder='Provide a response entry that customers can select'])[2]")).click();
At the same time I have corrected the syntax in indexing
Building on #Anand 's answer, you can simplify a little:
WebElement button1 = driver.findElement(By.xpath("(//input[#type='text' and #placeholder='Provide a response entry that customers can select'])[1]"));
WebElement button2 = driver.findElement(By.xpath("(//input[#type='text' and #placeholder='Provide a response entry that customers can select'])[2]"));
I think it's a little easier to read using and instead of stacking brackets.
I use it similarly for widgets:
WebElement header = driver.findElement(By.xpath("//div[contains(#class,'panel')]/div[contains(#class,'panel-heading') and text()[contains(.,'News Feed')]]"));

Chart data does not link to interactive report page in APEX

I am attempting to create a link in an APEX (Oracle) chart which will open an interactive report page by using the "Link Builder -Target" wizard.
Link Builder -Target Dialog]1
Unfortunately the link is passing the column name (bob) rather than it's value:
https://xxxxxxxxx.xxxx.xxx:xxxx/ords/f?p=100:51:19910173095277::NO:RP,51:P51_TARGET_FIELD:#BOB#
If I substitute a value for #BOB#, the interactive page opens properly.
How do I get APEX to pass the column value rather than the column name to the linked page?
Is BOB a chart column?
If not in the Link Builder, use the selector on 'Value' to select the corresponding column from the chart, such as #NAME#.
Regards,
David
Page Designer vs Legacy Component View
Apex 5.0 still using anychart charts, but using Page Designer the query of the chart is not validate. If you change to Legacy Component View you must see a error on save the chart with this query.
The selects in anychart charts need a query following these terms:
*BOB column is not valid to use on Link Builder Target
Try to put the value of the BOB column in the LINK column, like:
SELECT
bob AS LINK,
or use APEX_UTIL.PREPARE_URL, in this case it's not necessary to use Link Builder Target.
...
The query needs only three columns called LINK, LABEL and VALUE. Use alias to make this.
SELECT
APEX_UTIL.PREPARE_URL
('f?p=&APP_ID.:14:&APP_SESSION.::::P14_RECIEVER,P14_VALUE:' || bob || ',' || quantity) AS LINK,
month AS LABEL,
quantity AS VALUE
FROM mytable
https://apex.oracle.com/pls/apex/f?p=4550
Workspace: STACKQUESTIONS
User: test
Password: test
Issue page: https://apex.oracle.com/pls/apex/f?p=145797:10

Oracle APEX 5 Dynamic Action upon page load event does not work. What am i doing wrong?

The program basically aims at retrieving some fields of a record and processing and displaying that on a textbox of static content region in apex 5
My database: LCD_MONItOR table
Interface :
PLSQL code that is supposed to execute on page load event.
Declare
lcd_id LCD_Monitor.LCD__NO%TYPE;
tag LCD_Monitor.ASSET_TAG%TYPE;
pp LCD_Monitor.PURCHASE_PRICE%TYPE;
sal LCD_Monitor.SALVAGE%TYPE;
ls LCD_Monitor.LIFE_SPAN%TYPE;
accm LCD_Monitor.ACCUMULATED_DEP%TYPE;
netbook Number;
currDep Number;
Begin
select LCD__NO, ASSET_TAG, PURCHASE_PRICE,SALVAGE, LIFE_SPAN,
ACCUMULATED_DEP into lcd_id, tag, pp, sal, ls, accm from LCD_MONITOR
where LCD__No='40';
:LCD_NO:=lcd_id;
:CURR_DEP:= (pp-sal)*(1/ls);
:TOT_DEP:= (pp-sal)*(1/ls)+accm;
:NBV:=pp-(pp-sal)*(1/ls)+accm;
End;
PS: I have returned the values to the textboxes in 'Affected Elements' Section in the properties.
But when the page is loaded, no values appear in the textboxes. Any help would be appreciated.
I'm not sure if I understood correctly what exactly are you doing. If you need just fill items with data, create a before header process (in Page Designer mode, it is in Pre-rendering -> Before Header. Write your code there, it should be enough.
If you want to do it in Dynamic Action (I wouldn't recommend this way), you need to create a Dynamic Action with Event - Page Load, which will contain a True Action with properties: Action - Execute PL/SQL Code, PL/SQL Code - your code and Items to Return - LCD_NO,CURR_DEP,TOT_DEP,NBV
But make sure your items really have such names, because by default APEX creates items with names like P10_LCD_NO, where 10 (for example) is a number of the page.
Instead of directly assigning a calculated value to the textfields items, I assigned them to a variable first then assigned variables to the items i.e
Before
:CURR_DEP:= (pp-sal)*(1/ls);
:TOT_DEP:= (pp-sal)*(1/ls)+accm;
:NBV:=pp-(pp-sal)*(1/ls)+accm;
Corrected
currDep:= (pp-sal)*(1/ls);
:CURR_DEP:= currDep;
tot:= (pp-sal)*(1/ls)+accm;
:TOT_DEP:=tot;
netbook:=pp-((pp-sal)*(1/ls)+accm);
:NBV:=netbook;

Passing apex page items via button click

I'm baffled by this and hoping someone can explain this behavior to me.
I have a sample apex app here https://apex.oracle.com/pls/apex/f?p=126734:2 (admin credentials: username: guest pw: cubsarechamps).
I just want to enter a value on page 2 in text field P2_SOURCE and then click the button and be redirected to page 3 and have the value from P2_SOURCE populate P3_TARGET. I know that I need to set the value of P2_SOURCE in session and so I created a 'lose focus' dynamic action with a plsql process of null that also submits P2_SOURCE.
After I enter '123' in P2_SOURCE I tab out of the field to trigger the DA, and then I click session in my developer toolbar and I can see that the value of P2_SOURCE is indeed '123'. Then I click my button to go to page 3 but nothing is passed to P3_TARGET (unless I actually submit my page first, which I shouldn't have to do, right?).
So my question is why P2_SOURCE isn't being passed to P3_TARGET. The item is set in session state so why is &P2_SOURCE. passing a null value when there is a value set in session? Can I not use page item substitutions unless I actually submit my page? The documentation seems to indicate this is supported functionality.
My button setup is like this:
Substitution Strings are evaluated when the page is loaded and so, it is NULL in your case as the page item contains no value in the beginning. I would either use Dynamic Action with JavaScript Expression or Branch Process.

How can I store a dynamic text value in selenium ide and use it later in different window

I am new in selenium and trying to learning. I am creating a script and I got stuck here, I want to store a dynamic value from text message on web page ex. " Event Name:Test" this Event Name is dynamic and I want to store this and want to get in other window. In 2nd window i want to use this value(Test) to verify in the page
I tried storeValue, StoreText and storeAttribute command and getting error message for xpath or "element not found".
Please help me and advice me , what should I do?
Can You please suggest me the Xpath for storing and retrieving the event name. Please help me...
Thanks in advance,
Niru
If you are using the same test-case to navigate from page 1 to page 2 you can use the storeText function in the IDE to store the value of your event name. And then you can use the same variable in the page 2 for verification.
For example, in page 1 to store the value of event you use:
storeText(locator1, temp)
And then on page 2 you use assert:
assertText(locator2, ${temp})