Page 1 of 1
Hide text if empty
Posted: Fri Aug 31, 2007 7:55 am
by Fabio Pagano
I have a text with this expression:
Telephone: {MyDataSource.TelephoneNumber}
So the output is:
"Telephone: 4512328"
The field "MyDataSource.TelephoneNumber" is sometimes empty: in this case the printed text is:
"Telephone: "
I don't want to print the fixed string if {MyDataSource.TelephoneNumber} is empty. How can i do this?
Please note that i don't want to use code in report code.
Thanks.
Hide text if empty
Posted: Fri Aug 31, 2007 8:20 am
by EDV Gradl
Clear the Text Property and add this GetValueEvent:
if (String.NullOfEmpty(MyDataSource.TelephoneNumber))
e.Value = String.Empty;
else
e.Value = "Telephone: " + MyDataSource.TelephoneNumber;
Hide text if empty
Posted: Fri Aug 31, 2007 8:37 am
by Fabio Pagano
Thanks, but i was searching another way because i don't want to use code in report code.
Hide text if empty
Posted: Fri Aug 31, 2007 8:50 am
by EDV Gradl
Use alread use code, because the whole report is code. Just click on the tab Code and you'll see it.
Marco
Hide text if empty
Posted: Fri Aug 31, 2007 8:56 am
by Fabio Pagano
Autogenerated code is ok, but i don't want to add more code because i will not design the reports, my customers will design reports and they don't know nothing about how to write code.
Thanks.
Hide text if empty
Posted: Fri Aug 31, 2007 9:56 am
by EDV Gradl
Hmm, I see, maybe you could write your own Assembly with e.g. methodShowText, which provides the hidden text, reference is in the report and then your user just had to type {ShowText("Telephone: ", MyDataSource.Telephonenumber)}
This way your user does not need to code and still get the desired result.
Marco
Hide text if empty
Posted: Fri Aug 31, 2007 10:00 am
by Guest
You can use the IIF function in textbox:
Code: Select all
{IIF(MyDataSource.TelephoneNumber is null || MyDataSource.TelephoneNumber == "", "", "Telephone: " + MyDataSource.TelephoneNumber)}
or
Code: Select all
{IIF(MyDataSource.TelephoneNumber is null || MyDataSource.TelephoneNumber == "", "", "Telephone: ")}{MyDataSource.TelephoneNumber}
You can't solve your problem without this function, or writing code.
Thank you.
Hide text if empty
Posted: Fri Aug 31, 2007 6:20 pm
by Fabio Pagano
"IIF" is ok. Before posting, i searched for it through intellisense in text editor, but it didn't appear. Is there another way to find it?
Thanks to all.
Hide text if empty
Posted: Mon Sep 03, 2007 4:00 am
by Guest
You may use the StimulReport User Manual (
http://www.stimulsoft.com/Documentation ... Manual.zip) to find various information about features of StimulReport.
Thank you.