Method Community

 

Method Report Designer Suppress Empty Field

Last post 01-10-2011 12:31 AM by PLD Inc. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-08-2011 2:34 PM

    Method Report Designer Suppress Empty Field

    I have successfully modified my invoice.  I have one problem that I'm hoping someone can help me with:

    Looking just at Billing Address, I have four fields vertically aligned:

    Bill Address Addr1

    Bill Address Addr2

    Bill Address Addr3

    Invoice Bill Address City, ...State, ...Zip

     

    Some invoices have Addr1 and Addr2, some have Addr1, Addr2, and Addr3.

    The way it is set up now (I used the default template as the model) It looks good if I have all three fields populated.  However, if I have nothing in Addr3, I have a one line gap on the printed invoice between Addr2 (typically street) and the city, state, zip line.

     

    Is there a way to suppress Addr3 when it is empty so that there is not a one line gap on the printed address?  I want my invoice generated from qxpress to look like what I get out of quickbooks.  I am close - this is the last issue.

     

    Can anyone help?

     

    Thanks!  

    Laurie from PLD

     

  • 01-08-2011 2:54 PM In reply to

    Re: Method Report Designer Suppress Empty Field

    Answer

    Laurie -

    Congrats at customizing your invoice!

    Check out how we did the "Estimate (Custom)" template was built.  It's tricky, but here's how we did it:

    1. Put one textbox object, called xrBillAddress.

    2. Edied the properties in the lower-right of the designer, expanded the Scripts property, and clicked in the Before Print script.

    3. Click the "..." in Before Print Script.

    4. Put the following script in.  This way it formats it nicely.  You can just copy and paste this and it'll work, as long as you called your textbox "xrBillAddress" as well.

    Paul

    Private Sub OnBeforePrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintEventArgs)
    'Create a carriage return variable, for simplicity
    dim sNewLine as String = Microsoft.VisualBasic.ChrW(13) + Microsoft.VisualBasic.ChrW(10)

    xrBillAddress.Text = GetCurrentColumnValue("BillAddressAddr1") _
    + Microsoft.VisualBasic.Interaction.IIf(GetCurrentColumnValue("BillAddressAddr2") <> String.Empty,sNewLine + GetCurrentColumnValue("BillAddressAddr2"),"") _
    + Microsoft.VisualBasic.Interaction.IIf(GetCurrentColumnValue("BillAddressAddr3") <> String.Empty,sNewLine + GetCurrentColumnValue("BillAddressAddr3"),"") _
    + Microsoft.VisualBasic.Interaction.IIf(GetCurrentColumnValue("BillAddressCity") <> String.Empty,sNewLine + GetCurrentColumnValue("BillAddressCity") + ", " + GetCurrentColumnValue("BillAddressState") + " " + GetCurrentColumnValue("BillAddressPostalCode"),"") _
    + Microsoft.VisualBasic.Interaction.IIf(GetCurrentColumnValue("BillAddressCountry") <> String.Empty,sNewLine + GetCurrentColumnValue("BillAddressCountry"),"")

    End Sub 

  • 01-10-2011 12:31 AM In reply to

    Re: Method Report Designer Suppress Empty Field

    Thanks!  I'll give it a shot

Page 1 of 1 (3 items)