SV: totc()

Daniel Sananes danielsananes at
Sat Dec 13 04:13:33 EST 2014

Thanks Guys!

Geir, boolean expression. That explains it. In the ref.pdf it does not say anything about boolean expression.

Gary, good lecture! It made it better, not worse.

George, you're right. It excludes credit invoices. Nice deduction.

Doug, I didn't copy it to Studio, it comes later. Still in O7. But it may be possible to use #LSEL in O7-lists.


Case closed. I am happy.




-----Ursprungligt meddelande-----
Från: Geir Fjærli

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 < <mailto:danielsananes at> danielsananes at>:


> 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


More information about the omnisdev-en mailing list