totc()

Geir Fjærli omnis at sunshinedata.com
Fri Dec 12 13:51:55 EST 2014


It doesn’t. «Select» the correct lines, that is. 

What it does is (InvType='F'&(InvAmount>=0&InvTotal>=0)) is a boolean calculation that evaluates to zero for the lines you want to exclude. And by using totc() you tell Omnis to perform the calculation for each line before returning the result.

So all lines are included, but the lines that doesn’t match return zero because of the added boolean calculation. This is the way Omnis and other languages work, a boolean True evaluates to 1 and a boolean False evaluates to zero, and so your InvAmount is multiplied by either 1 or 0.

Geir :)

> 12. des. 2014 kl. 19.06 skrev Daniel Sananes <danielsananes at hotmail.com>:
> 
> 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