Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Functions in a select
Message
 
 
À
25/08/2008 15:58:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01341594
Message ID:
01341623
Vues:
13
Don,

Why not use replace ALL instead of SCAN/ENDSCAN ?

But please check both - my solution + yours and tell us which one performed better.

>Sorry Sergey, It's not clear what you meant. However, based on comments from the others this is what I have now.
>select *, 00000000 as expended ;
>from rta_elements ;
>order by elementnum ;
>into cursor crsElements readwrite
>
>scan
>replace expended with GetExpendituresBySubelement(elementnum)
>endscan
>
>
>function GetExpendituresBySubElement
>lparameters lnSubElement
>local lnOldWorkArea, lnRetVal
>dimension lnRetval(1)
>lnOldWorkArea = select(0)
>
>select  sum(amount) ;
>from tip ;
>inner join ledger on ledger.tip_id = tip.tip_id and source="RTA" ;
>where val(substr(sponsor_id,5,2)) = lnSubelement;
>into Array lnRetVal
>
>select(lnOldWorkArea)
>return iif(isnull(lnRetVal),0,lnRetVal)
>
>
>Any critique on this?
>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform