|
Re: get column sum if its records are checked [message #329458 is a reply to message #329396] |
Wed, 25 June 2008 08:41 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
I will complete or correct your work if you agree to do mine.
Can I send you my work for today?
If you have a specific issue, describe it and ask about that specific thing. Don't ask people to do your work for you, unless you are willing to pay them your salary.
|
|
|
Re: get column sum if its records are checked [message #329539 is a reply to message #329396] |
Wed, 25 June 2008 13:27 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amdabd
Messages: 91 Registered: November 2007 Location: My Computer
|
Member |
|
|
Frank wrote on Wed, 25 June 2008 08:41 | Don't ask people to do your work for you, unless you are willing to pay them your salary.
|
Perhaps, I misused words, but I'd never ask any body to do my job, Mr.Frank.
I used the forum to learn more, as other did, and really it enhance my knowledge,
NOT TO LET OTHER DO MY JOB
I think, I've t ask -Mr.Frank- in '5466' message you sent to this forum " asking for " and " answer " questions how many times did you pay to get information and answer for your question?
OR JUST YOU ANSWER THIS QUESTION!!
thanks
[Updated on: Wed, 25 June 2008 13:28] Report message to a moderator
|
|
|
Re: get column sum if its records are checked [message #329548 is a reply to message #329539] |
Wed, 25 June 2008 14:42 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
As I indicated, my conclusion was based on the fact that you did not make clear what it was you tried; where it went wrong.
The idea of a forum is that someone asks a question and hopes other people will put in effort to answer that and help out with the problem presented.
This implies that the forum-community can expect some effort from the person asking the question first; after all, that is the one seeking help.
Adding an fmb and asking people to correct and improve it is NOT what I consider putting effort in a question.
Why not explain what you did? Tell what you tried, why it failed, etc.
|
|
|
|
Re: get column sum if its records are checked [message #329656 is a reply to message #329637] |
Thu, 26 June 2008 02:45 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
That is probably because :emp.di_sum is part of the :emp record, which means that it has an occurrence per record.
Tips:
- Use a field that is global to the block (or the form)
- be careful of initialisations
- don't use "select from dual" to do assignments (:sum_field = nvl(:sum_field, 0) + nvl(:emp.sal, 0) is all you need)
|
|
|
|
Re: get column sum if its records are checked [message #329660 is a reply to message #329637] |
Thu, 26 June 2008 02:55 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Create another (control) block (let's call it "sum_sal") and move "di_sum" item over there. Initialize it in the WHEN-NEW-FORM-INSTANCE trigger as
WHEN-CHECKBOX-CHANGED trigger doesn't have to be THAT complicated; this is enough:if checkbox_checked('emp.chk1')
then
:sum_sal.di_sum := :sum_sal.di_sum + nvl(:emp.sal, 0);
end if;
However, do you realize that summary will be increased if you check-uncheck-check-uncheck-check-... the same checkbox all over again?
[EDIT] Yes, you DO realize (but I didn't, sorry); so, a "working" trigger might look like this:if checkbox_checked('emp.chk1')
then
:sum_sal.di_sum := :sum_sal.di_sum + :emp.sal;
else
:sum_sal.di_sum := :sum_sal.di_sum - :emp.sal;
end if; Also, I apologize for reposting almost everything what's already been said in the past few minutes by other forum members, but - today OraFAQ Forum is extremely slow, or MY connection sucks and posting or viewing messages lasts forever. I just didn't see what you guys have said. Sorry again.
[Updated on: Thu, 26 June 2008 03:05] Report message to a moderator
|
|
|
|
|
|