totc()

Gary Connor gary_connor at directline-tech.com
Fri Dec 12 14:00:08 EST 2014


What Geir said as actually more correct - where I say it "acts as a filter" his statement that it actually evaluates those lines as zero is more accurate.  Same impact on the result.


Gary Connor, Ph.D., CIO
DirectLine Technologies, Inc.
1600 N Carpenter Rd  Ste D
Modesto, CA 95351




|-----Original Message-----
|From: omnisdev-en-bounces at lists.omnis-dev.com [mailto:omnisdev-en-
|bounces at lists.omnis-dev.com] On Behalf Of Geir Fjærli
|Sent: Friday, December 12, 2014 10:52 AM
|To: OmnisDev List - English
|Subject: Re: totc()
|
|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
|
|___________________________________________________________
|__
|Manage your list subscriptions at http://lists.omnis-dev.com


More information about the omnisdev-en mailing list