totc()
Doug Easterbrook
doug at artsman.com
Fri Dec 12 14:15:49 EST 2014
hi Daniel:
when you say copied, I'm assuming copied from omnis 7 to studio....
if thats the case, then totc() is a bit more explicit.
you need to do
calc var as list.totc((list.invAMount)*(list.InvType='F'&(list.InvAmount>=0&list.Invtotal>=0))
I've explicitly put 'list.' in front of all variables.
there is an even FASTER way to do it.
do list.$search($ref.invType='F'&($ref.InvAmount>0&$ref.Invtotal>=0)
calc total as list.$totc(list.InvAMount,KTRUE)
if you have a LOT of lines in the list, then selecting a sub set appropriately first
AND THEN
using the KTRUE as the final parameter of the $totc() will only evaluate things for the selected lines
means that you can do things like selecting all items where invAmount>0 and then get subtotals of the selected lines like you were thinking
eg:
do list.$search($ref.InvAmount>=0)
calc total1 as list.$totc(list.InvAMount*(list.InvType='F')),KTRUE)
calc total2 as list.$totc(list.InvAMount*(list.InvType='G')),KTRUE)
calc total3 as list.$totc(list.InvAMount*(list.InvType='H')),KTRUE)
3 different totals, but only for lines where the InvAMount>0
(no point in selecting lines where invAmount=0 because totalling zero is generally zero.
Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 536-1205 Fax (403) 536-1210
> On Dec 12, 2014, at 11:06 AM, Daniel Sananes <danielsananes at hotmail.com> wrote:
>
> Hi again,
>
>
>
> Wonder if someone can explain why these two present the same result. I just
> copied these from codes in an omnis7-application.
>
> I do not understand how the longer totc()-expression understands itself.
>
> Calculate Amount as
> totc((InvAmount)*(InvType='F'&(InvAmount>=0&InvTotal>=0)))
>
> Calculate Amount as tot(InvAmount)
>
> Does the (InvType='F'&(InvAmount>=0&InvTotal>=0))-expression really selects
> the correct lines. Obviously it does. But how?
>
> And how does InvAmount multiplied by the expression work. I don't understand
> the logic.
>
>
>
> The second calculation is from a list which was merged with
> InvType='F'&InvAmount>=0&InvTotal>=0 for testing the correctness of it all.
>
>
>
> Hope someone has the good heart to lecture me!
>
>
>
> Regards
>
> Daniel
>
>
>
>
>
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list