In the report where you want (weight) / sum(value)) displayed, for the experssion put in the name of your UDF
Then make a UDF with that name (wherever you keep your code), which works like a VFP function. Include a LParameters statement to pass a variable to indicate grouping level. Write a SQL sttement to generate your number (or procedural code) and return the value back to the calling program(report)
Bob
>How ?
>Could you give me an example ?
>thx
>
>>You could use a User Defined Function that returned the value you wanted with passed parameters.
>>
>>Bob
>>
>>>I thought about that but i don't know how many groups1 i will have and i wanted to let the report to do the "dirty work" :)
>>>>Use report variables to sum weight and value, which can then be used in your footer to do the calculation.
>>>>
>>>>Bob
>>>>
>>>>>I have this problem with totals
>>>>>
>>>>>In a report with a kind of structure like this :
>>>>>
>>>>>group 1
>>>>>group 2
>>>>> month1 month2 month3 month4 . . . . . month12
>>>>>
>>>>>weight
>>>>>Value
>>>>>----------------
>>>>>group2 footer
>>>>>
>>>>>tot weight
>>>>>tot value
>>>>>-------------
>>>>>group 1 footer
>>>>>
>>>>>well, i can have the totals weight and value using the "calculate" function of reports, but i dont' know how to get the middle price sum(weight) / sum(value)
>>>>>
>>>>>How can i do ?
'If the people lead, the leaders will follow'
'War does not determine who is RIGHT, just who is LEFT'