How To Apply Group by Command in Forms 6i [message #555234] |
Tue, 22 May 2012 10:06 |
qanita786
Messages: 229 Registered: May 2007 Location: PAKISTAN
|
Senior Member |
|
|
How To Apply Group by Command in Forms 6i at block level for example in data block a field name is code,quantity and code replicate many times it is not working with out commit but i want to calculate sum of quantity in data block by code group before commit
if we apply this command at sql level then command is
select code,sum(nvl(quantity,0)) from sal_detail group by code and its work very well
Regards
Faheem
|
|
|
|
|
Re: How To Apply Group by Command in Forms 6i [message #555301 is a reply to message #555299] |
Wed, 23 May 2012 02:11 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
If that's the case, maybe you shouldn't base your data block on a table that is supposed to store these values. Create another, possibly a global temporary table, and base data block on it. Store values in there, and then - after the job is done - do something like
insert into your_real_table (code, quantity)
select code, sum(quantity)
from newly_created_table
group by code;
A simple way to do that would be, for example, a push button in a form. Or a database trigger. Or any other option you find appropriate.
|
|
|
|
|
|
|
|
|
Re: How To Apply Group by Command in Forms 6i [message #555365 is a reply to message #555347] |
Wed, 23 May 2012 08:42 |
ranamirfan
Messages: 535 Registered: January 2006 Location: Pakistan / Saudi Arabia
|
Senior Member |
|
|
Quote:
Code Quantity
---- --------
A 100
A 200
B 1000
C 500
C 300
Result
Code Quantity
---- --------
A 300
B 1000
C 800
As my opinion.
First - Not Possible you 'll not get this result in your current Canarios.
Second - Possible with one option as said Mr.Littlefoot.
Quote:
If that's the case, maybe you shouldn't base your data block on a table that is supposed to store these values. Create another, possibly a global temporary table, and base data block on it. Store values in there, and then - after the job is done - do something like
insert into your_real_table (code, quantity)
select code, sum(quantity)
from newly_created_table
group by code;
A simple way to do that would be, for example, a push button in a form. Or a database trigger. Or any other option you find appropriate.
Third - If you want to see detail of Code A with Quantity 300 then where you'll get it.As my opinion this not good idea in entry level.
Forth - Show your summarized Data in a Report not a form.
Regards,
Irfan
|
|
|
Re: How To Apply Group by Command in Forms 6i [message #555501 is a reply to message #555365] |
Thu, 24 May 2012 11:50 |
|
nnigam
Messages: 12 Registered: May 2012 Location: Washington, DC
|
Junior Member |
|
|
I think what littlefoot is trying to say is that your block is based on a table. So there is a one to one correspondence between the fields in your form and records in your table. Each field in your form corresponds to a field in the table. What you should do is to de-link the form field from a table field and save it to a cumulative variable. When you are ready to save your records, update the table from the variable. You will have then have your desired result.
By the way, have you ever thought about upgrading your forms to 11g. Even 10g is now out of support.
Neeraj Nigam
Pitss America
http://wwww.pitss.com/us
[Updated on: Tue, 29 May 2012 01:54] by Moderator Report message to a moderator
|
|
|