Hide text if empty
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Hide text if empty
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.
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
Clear the Text Property and add this GetValueEvent:
if (String.NullOfEmpty(MyDataSource.TelephoneNumber))
e.Value = String.Empty;
else
e.Value = "Telephone: " + MyDataSource.TelephoneNumber;
if (String.NullOfEmpty(MyDataSource.TelephoneNumber))
e.Value = String.Empty;
else
e.Value = "Telephone: " + MyDataSource.TelephoneNumber;
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Hide text if empty
Thanks, but i was searching another way because i don't want to use code in report code.
Hide text if empty
Use alread use code, because the whole report is code. Just click on the tab Code and you'll see it.
Marco
Marco
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Hide text if empty
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.
Thanks.
Hide text if empty
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
This way your user does not need to code and still get the desired result.
Marco
Hide text if empty
You can use the IIF function in textbox:
or
You can't solve your problem without this function, or writing code.
Thank you.
Code: Select all
{IIF(MyDataSource.TelephoneNumber is null || MyDataSource.TelephoneNumber == "", "", "Telephone: " + MyDataSource.TelephoneNumber)}
Code: Select all
{IIF(MyDataSource.TelephoneNumber is null || MyDataSource.TelephoneNumber == "", "", "Telephone: ")}{MyDataSource.TelephoneNumber}
Thank you.
- Fabio Pagano
- Posts: 355
- Joined: Mon Apr 16, 2007 12:38 pm
- Location: Bari (Italy)
Hide text if empty
"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.
Thanks to all.
Hide text if empty
You may use the StimulReport User Manual (http://www.stimulsoft.com/Documentation ... Manual.zip) to find various information about features of StimulReport.
Thank you.
Thank you.