Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

User defined Function within if function

 Post Reply Post Reply
Author
pdv-software GmbH Firma View Drop Down
Member
Member
Avatar

Joined: 02 Apr 2014
Posts: 46
Post Options Post Options   Quote pdv-software GmbH Firma Quote  Post ReplyReply Direct Link To This Post Topic: User defined Function within if function
    Posted: 21 Aug 2018 at 5:04pm
Hello,

is it possible to use a user defined function nested within a if function? I have an expression like:

<#if(TRUE(evaluate(CompressionEnabled));"active compression"; inactive compression)>

where CompressionEnabled is a user defined function returning a boolean result. But I get an error message stating that CompressionEnabled is not defined. I also tried it without the evaluate function but i still get the error.

When I use this function without the if function it is working. I'm using FlexCel version 6.18.0.0 .


Best Regards,

Christian Sack
Back to Top
Adrian Gallero View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 1226
Post Options Post Options   Quote Adrian Gallero Quote  Post ReplyReply Direct Link To This Post Posted: 21 Aug 2018 at 5:46pm
Hi,
I am not sure on where you define CompressionEnabled, but shouldn't it be <#CompressionEnabled> ?

I think you could define the expression like this:
<#if(<#CompressionEnabled>;"active compression"; "inactive compression")>

If compressionenabled is a function, not an expression or a value, then it would be:
<#if(<#CompressionEnabled()>;"active compression"; "inactive compression")>

But it is likely the first option
Back to Top
pdv-software GmbH Firma View Drop Down
Member
Member
Avatar

Joined: 02 Apr 2014
Posts: 46
Post Options Post Options   Quote pdv-software GmbH Firma Quote  Post ReplyReply Direct Link To This Post Posted: 22 Aug 2018 at 9:34am
Thanks for your help. It works with your provided example. I thought within the if function a user defined function is called like an existing Excel function. But thanks to pointing out the right way.

Best Regards,

Christian Sack
Back to Top
Adrian Gallero View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 1226
Post Options Post Options   Quote Adrian Gallero Quote  Post ReplyReply Direct Link To This Post Posted: 22 Aug 2018 at 10:49am
Maybe there is a confusion between "Excel user defined functions" and "FlexCel user defined functions". I know it isn't too cleat, but FlexCel user defined functions were implemented long before Excel user defined functions (like 10 years before), so in many places they are just referred as "user defined functions" and it might not be clear to which one we are referring to.

In short:
A FlexCel user defined function is used in reports, and they use the same <#tag> notation as every other tag.
An Excel user defined function is a function Excel can use and you define in a macro. Excel user defined functions indeed are called as normal Excel functions inside the <#if>, because they work as normal Excel functions.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down