Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building a conditional sum.
Message
 
À
24/12/1998 07:39:31
Marcelo Codino
Mystic & Faith - Sistemas -
Buenos Aires, Argentine
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00170185
Message ID:
00170207
Vues:
17
En casos como esos, you personalmente lo que hago de la siguente manera. Creo un procedure file. ejemplo: mylibrary.prg

En MyLibrary.prg tendrias PROCEDURES y FUNCTIONS:

**********************************
FUNCTION SumaMensual( m.lcDBF, m.lnMonth )
**********************************
LOCAL m.lcSQLWhere, m.lnReturnValue

m.lnReturnValue = 0
m.lcSQLWhere = "MONTH(tabledate) = " + TRANS( m.lnMonth )

SELECT ;
SUM(IIF(cond,option1,option2)) AS n_amount ;
FROM m.lcDBF ;
WHERE &lcSQLWhere.
INTO ARRAY aResults

IF _TALLY > 0
m.lnReturnValue = aResults[1]
ENDIF

RETURN( m.lnReturnValue )

En el reporte. La expression seria for ejemplo:

SumaMensual( "c:\mytable.dbf", 12 ) && pasa la tabla y el mes

Al llamar to reporte, lo haces asi:

SET PROCEDURE TO MyLibrary
REPORT xyz TO PRINT NOCONSOLE
SET PROCEDURE TO

Dejame saber si esto no te es muy claro.
Juan L. Romero
gcandela@javanet.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform