User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 397,810 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,517 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser:
Views: 1649 | Replies: 5
Reply
Join Date: Jan 2005
Posts: 24
Reputation: haria_kishore is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
haria_kishore haria_kishore is offline Offline
Newbie Poster

Help Urgent help required

  #1  
Dec 27th, 2006
Hi everyone

I have one master table with the following structure

incm_id Category SubCategory

1001 Expenses A
1002 Expenses B
1003 Income C
1004 Income D

I have a child table where i am capturing amount value for the above table and structure is something like

id fk_incm_id Amount

10001 1001 25
10002 1002 30
10003 1003 40
10004 1004 50

Now using Discoverer plus i need to show this information which i am able to do

But i then need to show total where i must deduct the values of expenses from income (i.e. Income - Expense)
I tried using decode to make the values of expenses negative but i dont want the values to be displayed as negative and still able to achieve my task
Please help me if there is a way out
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2006
Posts: 24
Reputation: alit2002 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
alit2002 alit2002 is offline Offline
Newbie Poster

Re: Urgent help required

  #2  
Jan 4th, 2007
Do you have to have the child table in this format? It would be easier if the income and expenditure were in different columns. You could create two views, one for income and the other for expenditure then the query would be simple.

If you can't do it this way then you may be able to create some derived columns in discoverer based on the category type and build totals from there.

Alistair
Reply With Quote  
Join Date: Dec 2006
Posts: 24
Reputation: alit2002 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
alit2002 alit2002 is offline Offline
Newbie Poster

Re: Urgent help required

  #3  
Jan 4th, 2007
My last reply wasn't very clear. If you can't have income and expenditure in different columns then try creating a view for income and one for expense. A simple join on the views would give you the results.

PS Not sure if a pivot table could be used to help get the totals?

Alistair
Reply With Quote  
Join Date: Jan 2005
Posts: 24
Reputation: haria_kishore is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
haria_kishore haria_kishore is offline Offline
Newbie Poster

Re: Urgent help required

  #4  
Jan 9th, 2007
Hi Alistair

U did not get my problem. I my able to get both income and expenditure items in the report

But to calculate profit, I have to deduct income-expenditure. I tried using decode to negate the values of expenditure but problem is that they are being shown as negative values in the report (which is not acceptable). The report should show expenditure value as positive but as same time should be able to be deducted from income values

hope now u got my problem

also i am creating reports using Discoverer plus

regards
Reply With Quote  
Join Date: Dec 2006
Posts: 24
Reputation: alit2002 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
alit2002 alit2002 is offline Offline
Newbie Poster

Re: Urgent help required

  #5  
Jan 9th, 2007
I do understand the problem. Is it possible to use pl/sql in a derived field to make the total?

Alistair
Reply With Quote  
Join Date: Dec 2006
Posts: 24
Reputation: alit2002 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
alit2002 alit2002 is offline Offline
Newbie Poster

Re: Urgent help required

  #6  
Jan 9th, 2007
Or use something like this

select sum(decode(fk_incm_id,'1003',amount, 0))+sum(decode(fk_incm_id,'1004',amount, 0))
-sum(decode(fk_incm_id,'1001',amount, 0))+sum(decode(fk_incm_id,'1002',amount, 0))"PROFIT/LOSS"
from child_table;

Alistair
Last edited by alit2002 : Jan 9th, 2007 at 9:19 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Oracle Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Oracle Forum

All times are GMT -4. The time now is 6:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC