` Printed Icetips Article

Icetips Article



SQL Related Articles: Using view to retrieve aggregate results
2004-03-17 -- Scott Ferrett
 
Newsgroups: softvelocity.public.clarion6


> DUMMYGETSUM{PROP:SQL}='SELECT ' &|
>                       ' SUM(Debit_Sindlr),' &|
>                       ' SUM(Credit_Sindlr),' &|
>                       ' COUNT(AUTONUMBER1),' &|
>                       ' SUM(Debit_Actual),' &|
>                       ' SUM(Credit_Actual),' &|
>                       ' 0,' &|
>                       ' 0 ' &|
>                       ' FROM BANKDESC WHERE AUTONUMBER = ' & BNK:AUTONUMBER


This is probably easier to code in SQL, but you can code it in pure Clarion
thus:

v VIEW(DummyGetSum)
    PROJECT (DUMSUM:VALUE1)
    PROJECT (DUMSUM:VALUE2)
    PROJECT (DUMSUM:VALUE3)
    PROJECT (DUMSUM:VALUE4)
    PROJECT (DUMSUM:VALUE5)
  END

v{'DUMSUM:VALUE1', PROP:Name} = 'SUM(Debit_Sindlr)'
v{'DUMSUM:VALUE2', PROP:Name} = 'SUM(Credit_Sindlr)'
v{'DUMSUM:VALUE3', PROP:Name} = 'COUNT(AUTONUMBER1)'
v{'DUMSUM:VALUE4', PROP:Name} = 'SUM(Debit_Actual)'
v{'DUMSUM:VALUE5', PROP:Name} = 'SUM(Credit_Actual)'
v{PROP:Filter} = 'SQL(AUTONUMBER =' & BNK:AUTONUMBER & ')'
SET(v)
LOOP
  Next(v)
  If ErrorCode() 
    Break
  End
End



Printed November 23, 2024, 2:08 am
This article has been viewed/printed 35218 times.
Google search has resulted in 31 hits on this article since January 25, 2004.