Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Calling report from a form/report (Apex 3.2.1, Windows 7)
Calling report from a form/report [message #537589] Thu, 29 December 2011 10:41 Go to next message
tinkuvinay
Messages: 9
Registered: December 2011
Location: Dallas
Junior Member
Hello all,

I have created an application on some tables. Each table has a report and form page. Now everything in these pages is working fine(inserting, updating, deleting records).

I have a situation here, where after I insert a new record in to a table from the form page, here I have to show a report page based on a SQL querry which queries the records from another table and the current table passing the parameters. Parameters should be the values that I enter during inserting a record.

Can I do this from form or report? If yes, how?

Please help me...
Re: Calling report from a form/report [message #537600 is a reply to message #537589] Thu, 29 December 2011 12:41 Go to previous messageGo to next message
Littlefoot
Messages: 21805
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here's an example.

I created a form based on Scott's EMP table, a default one, nothing fancy about it. Its page number = 2.

Then, I created a report (page 7) whose query looks like this:
select *
from emp
where job = :P2_JOB

The last line (where job = :P2_JOB) does what you requested: "Parameters should be the values that I enter during inserting a record". In my example, there's only one parameter - job name. Report is supposed to display all employees who do the same job as the newly created employee.

Finally, modify branch on the form page - let it open page 7:

/forum/fa/9681/0/

OK, let's test it.

Enter a new employee:

/forum/fa/9682/0/

Push the "Create" button - the following report is displayed:

/forum/fa/9683/0/

Here they are, all clerks:
SQL> select * from emp where job = 'CLERK';

     EMPNO ENAME      JOB              MGR HIREDATE          SAL       COMM     DEPTNO
---------- ---------- --------- ---------- ---------- ---------- ---------- ----------
      7369 SMITH      CLERK           7902 17.12.1980        800                    20
      7876 ADAMS      CLERK           7788 12.01.1983       1100                    20
      7900 JAMES      CLERK           7698 03.12.1981        950                    30
      7934 MILLER     CLERK           7782 23.01.1982       1300                    10
         3 Littlefoot CLERK                                  100                    20

SQL>


I hope it helps.
Re: Calling report from a form/report [message #537609 is a reply to message #537600] Thu, 29 December 2011 13:08 Go to previous messageGo to next message
tinkuvinay
Messages: 9
Registered: December 2011
Location: Dallas
Junior Member
Thank you very much for the idea...

In my application I have one-level tabs for each table.
Let me explain with your example....
Let's say I have EMPLOYEE tab, and DEPARTMENT tab.

The respective tab will have it's own report and form page.
Now I have another table(table3) with large number of columns which has the extra information.
When I insert a new employee, which will impact some information in the table3. I would have a look at the data that is affected. So this can be achieved by your example query.

But the flow have to be like this.
1. I will fill all the employee information in the EMPLOYEE form page, then hit "CREATE" button.

2. "CREATE" button should take me to the page5(sql report page) under the same EMPLOYEE tab, which will show me the records that will have impact.
Here, this page need not be an interactive report page... just a regular report page will be fine.

3. From the report page,
when I click on the button "OK" this should take me to the page1(EMPLOYEE report page)
when I click on the button "CANCEL" this should take me to the page2(EMPLOYEE form page)
Re: Calling report from a form/report [message #537611 is a reply to message #537609] Thu, 29 December 2011 13:21 Go to previous message
Littlefoot
Messages: 21805
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator

  1. OK, that works
  2. I told you how to do that - create/modify a branch. Tabs don't matter, you only set a page number. Report page type doesn't matter (as you said). I created an ordinary SQL report in my example.
  3. Branch contains "When button pressed" field. From help: "Choose a button from the list, if you want your branch to only happen when that button is clicked." I'd suggest you to use it and create two branches - one to fire when you click the "OK" button, another one when you click the "CANCEL" button.
Previous Topic: Validation problem
Next Topic: Setting value of an item depending on the value of another item
Goto Forum:
  


Current Time: Tue Mar 19 06:46:47 CDT 2024