Home » Developer & Programmer » Reports & Discoverer » Inserting values when running a report! (Reports 6i, 10g Database)
Inserting values when running a report! [message #466376] Mon, 19 July 2010 06:22 Go to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Dear,

I have a report, where there are opening balance and closing balance, so i have to store the closing balance values
in a separate table during runtime and should show this closing value as opening balance for next month.
is it possible in a report how can we do?

Pls Help.

Stalin Ephraim.
Re: Inserting values when running a report! [message #466386 is a reply to message #466376] Mon, 19 July 2010 06:49 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't think that you should do that. Calculate opening balance directly from a table (you use to display values in the report).
Re: Inserting values when running a report! [message #466388 is a reply to message #466376] Mon, 19 July 2010 06:51 Go to previous messageGo to next message
ramoradba
Messages: 2456
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Not through report,but using sql.read about lag/lead functions?

sriram
Re: Inserting values when running a report! [message #466392 is a reply to message #466388] Mon, 19 July 2010 07:41 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Reports is capable of inserting values; but that's not the point.
Re: Inserting values when running a report! [message #466483 is a reply to message #466392] Mon, 19 July 2010 21:40 Go to previous messageGo to next message
ramoradba
Messages: 2456
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Report is capable of inserting values.
But thats not required here he can directly do that using sql.
May at my first reply I posted it wrongly.
Re: Inserting values when running a report! [message #466500 is a reply to message #466386] Mon, 19 July 2010 23:22 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Dear Littlefoot,

Its not calculated in that table, formula columns used to calculate from different tables and finally the table values from all the tables has to be added in a separate table(opcl) when the values were calculated and showed in respective closing value columns.

So we can use this closing values from that table(opcl), when we needed to display it in opening balance column in next month.

do you have an idea? how can we write the insert for these values.

[Updated on: Mon, 19 July 2010 23:24]

Report message to a moderator

Re: Inserting values when running a report! [message #466510 is a reply to message #466500] Tue, 20 July 2010 00:15 Go to previous messageGo to next message
mehediu
Messages: 46
Registered: February 2010
Location: Dhaka
Member

You can write insert or any other command you want in
"AFTER REPORT" trigger.

you know your requirements better. so use it as your requirement.

Thanking you
Md. Mehedi Hossain
Re: Inserting values when running a report! [message #466559 is a reply to message #466510] Tue, 20 July 2010 02:48 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, perhaps you should really rather do the calculation elsewhere (i.e. not in one of report's triggers). Because, what will you do if report is run more than once? You should take care whether that record already exists and do the update instead (or do nothing?). Perhaps Sriram's option is a better one, so some procedure would do the calculation and report would just display those values.

Otherwise, I agree with Mehedi - AFTER REPORT is a good place to do that kind of a job.
Re: Inserting values when running a report! [message #466992 is a reply to message #466510] Wed, 21 July 2010 23:15 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
function AfterReport return boolean is
begin
    --if (:total_credit) is not null then
  	insert into opcl (fiscal_yr_cd,Period_no,Col1,Col2,Col3,Col4,Col5,Col6)
  	 Values          (:P_Fiscal_yr,:P_Period,:total_credit, :total_cess_cf,
  	                  :total_sec_cess_cf, :cf_tot_serv_tax1, :cf_tot_serv_tax2,
  	                  :cf_tot_serv_tax3);
    --end if;  	
    commit;
  return (TRUE);
end;



I have written this insert, but not data is saved!
Re: Inserting values when running a report! [message #467005 is a reply to message #466992] Thu, 22 July 2010 00:36 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It should have been ... I thought that you, perhaps, forgot to commit - you didn't.

Another possibility is that fields' values are NULL (so nothing gets inserted).

Or, you use different schemas and inserted data into one of them, but checked in another. How did you check it, anyway? SQL*Plus?
Re: Inserting values when running a report! [message #467038 is a reply to message #467005] Thu, 22 July 2010 02:00 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Yes i have given commit after a insert command,
then i have put nvl function, and checked it in Pl/Sql Developer, but not inserted,

what might be the prob?
Re: Inserting values when running a report! [message #467496 is a reply to message #467038] Sat, 24 July 2010 21:49 Go to previous messageGo to next message
mehediu
Messages: 46
Registered: February 2010
Location: Dhaka
Member

Dear Mr. stalin

if still now your problem is not solved , please post your report and table script
if you no problem then. we can try with your report and tell you what is the problem you got.

Thanking you
Md. Mehedi Hossain
Re: Inserting values when running a report! [message #467568 is a reply to message #467496] Mon, 26 July 2010 01:46 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Dear Md. Mehedi Hossain and All Dear ones,

Thank you for your kind reply,
well i am attaching that report as a sample copy.rdf, and you can see the table which i want to insert as a comment, in the After Report Trigger.

In that report what we have to do is just i need to display the closing balance amount should be shown for next months Opening Balance.

for this i have written a insert in the after report.
pls check.

All are formula columns, just i have given what i need.


pls see it.

Reply soon as possible.

Stalin Ephraim

[Updated on: Mon, 26 July 2010 01:53]

Report message to a moderator

Re: Inserting values when running a report! [message #467570 is a reply to message #467568] Mon, 26 July 2010 01:51 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
if (:total_credit) is not null then insert

What is ":total_credit"'s value?
Re: Inserting values when running a report! [message #467575 is a reply to message #467570] Mon, 26 July 2010 02:04 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Another idea: how do you, exactly, test the report? Do you run it from Reports Builder? So - output is displayed, report is (obviously) done. Then what? You turn it off? Check whether there's something in the table, but - it is empty?

If so, well, you can't test it that way because After Report simply won't fire (in Reports Builder). You could, though, try the following: generate the output to a file (such as PDF):

/forum/fa/8078/0/

This will make the After Report trigger fire, and you'll probably see something in the table. At least, that worked fine for me (I created a dummy report based on Scott's schema).

On the other hand, if you ran the report from the application, the trigger should have fired. If that was the case, huh, no idea at the moment.
Re: Inserting values when running a report! [message #467609 is a reply to message #467575] Mon, 26 July 2010 04:15 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Dear,

I get the Value Rs. 4026603 as closing amount(:total_credit) for the month of Jun, but as we know that we cant show this formula column value in opening balance of July. because it would arise
this error;


REP-1241 Circular column dependency originating with column 'cenvat_opening'


so as advised i have to insert or store the other column values in a table [OPCL]which has already no data, because i created with no values and should insert values when i run the report.

so i wrote the insert command in that after report trigger for the insertion!

create table OPCL
(
FISCAL_YR_CD VARCHAR2(1),
PERIOD_NO VARCHAR2(2),
COL1 NUMBER(30,3),
COL2 NUMBER(30,3),
COL3 NUMBER(30,3),
COL4 NUMBER(30,3),
COL5 NUMBER(30,3),
COL6 NUMBER(30,3)
)

but why this insertion doesn't took place.

the values like

opening balance + credit taken on input on invoices + credit taken on capital goods + total credit availed - credit utilised for payment of duty goods = Closing Stock.


so i solidly get the values but this values i cant able to insert through a after report trigger.

i Need to know will this query effect or Not?
how to insert a value through a report?

function AfterReport return boolean is
begin
srw.message(100,'Hai');
if (:total_credit) is not null then
insert into opcl (fiscal_yr_cd,Period_no,Col1,Col2,Col3,Col4,Col5,Col6)
Values (:P_Fiscal_yr,:P_Period,nvl(:total_credit,0), nvl(:total_cess_cf,0),
nvl(:total_sec_cess_cf,0), nvl(:cf_tot_serv_tax1,0), nvl(:cf_tot_serv_tax2,0),
nvl(:cf_tot_serv_tax3,0));
commit;
end if;
return (TRUE);


I Hope you understand!!!

I give the Input fiscal year code as 'J' and Period no = '02'
here J = 2010, and Period_no = June.

Fiscal Year Code J = 2010, K = '2011' etc.
Period Nos June = '02', July = '03' etc.



[Updated on: Mon, 26 July 2010 04:16]

Report message to a moderator

Re: Inserting values when running a report! [message #467617 is a reply to message #467609] Mon, 26 July 2010 04:49 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Why don't you change the trigger to do a hard-coded insert - don't try use an calculated values.
If that works then we'll know that's not the trigger that's causing the problem but something else.
Re: Inserting values when running a report! [message #467621 is a reply to message #467617] Mon, 26 July 2010 05:09 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
No Effect even 'Hard-Coded' i have tried to give a

i cant debug if i give a message it never prompts.!!!

srw.message(100,'Hai');
Re: Inserting values when running a report! [message #467624 is a reply to message #467621] Mon, 26 July 2010 05:23 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I think that you still didn't answer how you test it - through Reports Builder or through your application? Did you read a message #467575 ?
Re: Inserting values when running a report! [message #467630 is a reply to message #467624] Mon, 26 July 2010 05:46 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Through Report Builder only,

by passing Parameter Values.
Re: Inserting values when running a report! [message #467632 is a reply to message #467630] Mon, 26 July 2010 05:59 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK. Did you try to do what I suggested, then? Generate report to PDF and then check whether values were inserted?
Re: Inserting values when running a report! [message #467633 is a reply to message #467630] Mon, 26 July 2010 06:00 Go to previous messageGo to next message
mehediu
Messages: 46
Registered: February 2010
Location: Dhaka
Member

Dear Mr. stalin

AFTER-TRIGGER will work when you run the report through Application i mean when you call this report from Form

when you run it in report builder you will not get any affect in database table
so you need to run it from Application.

Thanking you
Md. Mehedi Hossain
Re: Inserting values when running a report! [message #467634 is a reply to message #467632] Mon, 26 July 2010 06:02 Go to previous messageGo to next message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Yes Thanks it works when i applied the report in the application.

Re: Inserting values when running a report! [message #467638 is a reply to message #467634] Mon, 26 July 2010 06:19 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Gee, and what was I saying a whole day long?
Re: Inserting values when running a report! [message #467720 is a reply to message #467638] Mon, 26 July 2010 22:38 Go to previous message
stalin4d
Messages: 226
Registered: May 2010
Location: Chennai, Tamil Nadu, Indi...
Senior Member
Sorry... But thanks...
Previous Topic: Error Identifier 'GET_PRECISION' must be declared
Next Topic: Report Hangup
Goto Forum:
  


Current Time: Fri Apr 26 20:55:36 CDT 2024