Page 1 of 1

IIF and Substring

Posted: Mon Dec 13, 2010 7:56 am
by JockeD
Hello,

I not sure if I miss something obvious here but I have a problem with the following text epression

Code: Select all

{IIF(Length(Events.Comment)>50, Substring(Events.Comment,0,47) + "...", Events.Comment)}
If the expresion is true then the text is ok but nohing is displayed when the expresion is false.
If I remove the Substring everything works as expected.

Regards Joakim

IIF and Substring

Posted: Tue Dec 14, 2010 4:32 am
by Alex K.
Hello,

In this case, it is due to the fact that the IIF () method is attempting to execute both conditions, and it turns that an exception is thrown due to the length of the string. You can use the following expression for the solution of this problem:

Code: Select all

{Length(Events.Comment)>50 ? Substring(Events.Comment,0,47) + "..." : Events.Comment}
Also, in the nearest future, we plan to extend the functionality that can be used in expressions.


Thank you.

IIF and Substring

Posted: Tue Dec 14, 2010 5:08 am
by JockeD
Thank you, Aleksey

The report is in VB so I changed to

Code: Select all

{IF(Length(Events.Comment) > 50, Events.Comment.Substring(0,47) + "...", Events.Comment)}
Everything works as expected.

Thank you!

/Joakim


IIF and Substring

Posted: Tue Dec 14, 2010 5:29 am
by Alex K.
Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.

Re: IIF and Substring

Posted: Mon Jun 13, 2016 1:27 pm
by Kowal
Hello,

I also have a problem with IIF and Substring. I have build this formula:

Code: Select all

{IIF(Substring(address.address_opendays,0,1) == "N","NotWorking","Working")}
Syntax check is OK, but when i want to make a preview it throwing an error.
Could you tell me where i',m making mistake ?

Many Thanks,
Kowal

Re: IIF and Substring

Posted: Tue Jun 14, 2016 6:36 am
by HighAley
Hello, Kowal.

Could you specify what error do you get?
What version of our report do you use?

Thank you.

Re: IIF and Substring

Posted: Tue Jun 14, 2016 7:21 am
by Kowal
Add a screen of error in attachment.
I am using this software for the first time. How can i check report version ?

Thank you.

Re: IIF and Substring

Posted: Tue Jun 14, 2016 9:17 am
by HighAley
Hello.

Maybe the address.address_opendays is NULL or empty?
We need to see your report template with sample data to reproduce the issue.

Thank you.