Suppress empty filed

Report scripting discussion area

Suppress empty filed

Postby mbb » Fri Dec 11, 2009 12:27 pm

i'm creating an invoice in sales module. how do i suppress a field from displaying if it contains null or zero values ? any codes for that ?
mbb
 
Posts: 1
Joined: Fri Dec 11, 2009 12:23 pm

Re: Suppress empty filed

Postby autocount.daniel » Tue Jan 12, 2010 2:49 pm

Hello,

You may try the below script in the label > OnBeforePrint

Assume that the field is in the detail table, the field is "FromDocNo"

//------------------------------------------------------------------------------------------------------------------------------
object oFromDocNo = ppChildReport1.GetCurrentColumnValue("FromDocNo");
(sender as XRLabel).Text = (oFromDocNo!=null && oFromDocNo!=DBNull.Value)?oFromDocNo.ToString():"";
//------------------------------------------------------------------------------------------------------------------------------


Note that, the label.Text will never return a null or DBNull.Value value. Even if the data field is null, in the label.Text, it'll be "", aka empty string.

Regards,
Daniel
autocount.daniel
 
Posts: 62
Joined: Wed Dec 31, 2008 1:58 pm


Return to Report Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron