NAV 2013 Reports-Avoid blancks with empty text box

poppinspoppins Member Posts: 647
edited 2014-01-07 in NAV Three Tier
Hi everyone,

I am having an issue with empty text boxes in my reports.
I want to avoid the blanck space generated if the textbox is empty.

I tried to use the visibility property of the textbox this way:
=iif(Fields!CompanyAddr6.Value="", TRUE,FALSE)
and this way:
=iif(isNothing(CompanyAddr6.Value), TRUE,FALSE)
but it didn't work both ways, the empty space is still here ](*,)
How can I get rid of it?

Thanks in advance :)

Comments

  • clauslclausl Member Posts: 455
    If in the body use a filter instead visibility then it works. You of course need to add a table before you can filter, but just add a table with headers rows only.

    /Claus Lundstrøm
    Claus Lundstrøm | MVP | Senior Product Manager | Continia.com
    I'm blogging here:http://mibuso.com/blogs/clausl and used to blog here: http://blogs.msdn.com/nav
    I'm also offering RDLC Report Training, ping me if you are interested. Thanks to the 700 NAV developers that have now already been at my training. You know you can always call if you have any RDLC report issues :-)
  • poppinspoppins Member Posts: 647
    clausl wrote:
    If in the body use a filter instead visibility then it works. You of course need to add a table before you can filter, but just add a table with headers rows only.

    /Claus Lundstrøm

    The textbox I am dealing with is in the header of the report...
  • thegunzothegunzo Member Posts: 274
    I am using Code.GetData function for the fields in the header. for me

    =iif(Code.GetData(14,6) = "",true,false)

    is working
    ________________________________
    Gunnar Gestsson
    Microsoft Certified IT Professional
    Dynamics NAV MVP
    http://www.dynamics.is
    http://Objects4NAV.com
  • clauslclausl Member Posts: 455
    In headers it is not working, using visibility will not remove the actual space the textbox is using. Try to make 3 textboxes on top of each other and color them i.e. red, yellow and green.
    Now hide the yellow textbox and render your report. You will now see that it is not working, since the space of the yellow textbox still renders.

    For us to fix this in headers I only see one way to do this.

    Solution: You need to put all your Company Address fields in one textbox and use Carriage Return, Chr(10), after each expression, and set the CanGrow property to True.

    I have created a small demo report, which illustrate how to do this.

    WARNING!!! Page Header is not dynamic, so if you do not leave space in the PageHeader for the amount rows you expect the textbox to grow, the last rows will not be printed.
    It may look OK, in Print Preview, but always remember to check Print Layout, which is the actual picture of how the report looks when printed.

    You can find the small demo report here in pdf, txt, fob and OfflineReport files:
    http://sdrv.ms/12WRcLk

    /Claus Lundstrøm
    Claus Lundstrøm | MVP | Senior Product Manager | Continia.com
    I'm blogging here:http://mibuso.com/blogs/clausl and used to blog here: http://blogs.msdn.com/nav
    I'm also offering RDLC Report Training, ping me if you are interested. Thanks to the 700 NAV developers that have now already been at my training. You know you can always call if you have any RDLC report issues :-)
  • poppinspoppins Member Posts: 647
    thegunzo wrote:
    I am using Code.GetData function for the fields in the header. for me

    =iif(Code.GetData(14,6) = "",true,false)

    is working

    I've already tried that, it didn't work :(
  • poppinspoppins Member Posts: 647
    clausl wrote:
    In headers it is not working, using visibility will not remove the actual space the textbox is using. Try to make 3 textboxes on top of each other and color them i.e. red, yellow and green.
    Now hide the yellow textbox and render your report. You will now see that it is not working, since the space of the yellow textbox still renders.

    For us to fix this in headers I only see one way to do this.

    Solution: You need to put all your Company Address fields in one textbox and use Carriage Return, Chr(10), after each expression, and set the CanGrow property to True.

    I have created a small demo report, which illustrate how to do this.

    WARNING!!! Page Header is not dynamic, so if you do not leave space in the PageHeader for the amount rows you expect the textbox to grow, the last rows will not be printed.
    It may look OK, in Print Preview, but always remember to check Print Layout, which is the actual picture of how the report looks when printed.

    You can find the small demo report here in pdf, txt, fob and OfflineReport files:
    http://sdrv.ms/12WRcLk

    /Claus Lundstrøm
    Thanks for your help...
    I tried your method but it didn't work...
    I have four textboxes, with expressions: CompanyAddr3, CompanyAdrr4,CompanyAddr5 andCompanyAdrr6
    The problem is that when CompanyAdrr 5 and CompanyAdrr6 are empty, I am left with a blanck space...
    Even with your method, the white space is still here...
    I tried to put both properties CanGrow and CanShrink to True, but the white space is still here ](*,) ](*,) ](*,)
  • thegunzothegunzo Member Posts: 274
    poppins wrote:
    thegunzo wrote:
    I am using Code.GetData function for the fields in the header. for me

    =iif(Code.GetData(14,6) = "",true,false)

    is working

    I've already tried that, it didn't work :(

    if your aim is to remove the white space you will have to move the data from the header section to a table header in the body section. I think that is the only way.
    ________________________________
    Gunnar Gestsson
    Microsoft Certified IT Professional
    Dynamics NAV MVP
    http://www.dynamics.is
    http://Objects4NAV.com
  • clauslclausl Member Posts: 455
    Ok I did a little more test. I have now modified report 208 to behave as you expect.

    I needed to do 3 expresssion in 1 textbox to get it working. This is not possible in Visual Studio 2008, so we need NAV 2013 and VS 2010 to be able to do this trick.

    Modified Report 208 is now in the same folder as the other files:
    http://sdrv.ms/12WRcLk

    I marked the textbox orange to make it clear which textbox I have changed.

    /Claus
    Claus Lundstrøm | MVP | Senior Product Manager | Continia.com
    I'm blogging here:http://mibuso.com/blogs/clausl and used to blog here: http://blogs.msdn.com/nav
    I'm also offering RDLC Report Training, ping me if you are interested. Thanks to the 700 NAV developers that have now already been at my training. You know you can always call if you have any RDLC report issues :-)
  • clauslclausl Member Posts: 455
    It is actual quite simple to do :-)

    But do remember that the Page Header is not dynamic, so Page Header has to be big enough.

    /Claus Lundstrøm
    Claus Lundstrøm | MVP | Senior Product Manager | Continia.com
    I'm blogging here:http://mibuso.com/blogs/clausl and used to blog here: http://blogs.msdn.com/nav
    I'm also offering RDLC Report Training, ping me if you are interested. Thanks to the 700 NAV developers that have now already been at my training. You know you can always call if you have any RDLC report issues :-)
  • poppinspoppins Member Posts: 647
    clausl wrote:
    Ok I did a little more test. I have now modified report 208 to behave as you expect.

    I needed to do 3 expresssion in 1 textbox to get it working. This is not possible in Visual Studio 2008, so we need NAV 2013 and VS 2010 to be able to do this trick.

    Modified Report 208 is now in the same folder as the other files:
    http://sdrv.ms/12WRcLk

    I marked the textbox orange to make it clear which textbox I have changed.

    /Claus
    Thank you for your effort...
    I tried to design the report 208 to look at the textbox expression but I couldn't get it...
    I didn't understand how you put 3 expressions in one textbox...
    Can you please put the expression of the orange textbox??
    It worked indeed, but I didn't understand how you did it :oops:
  • clauslclausl Member Posts: 455
    A textbox has 2 modes you can select it.

    1. Overall select. It is like Excel when just selecting the cell. In this mode Properties for textbox are shown.
    2. Inside select. It is like F2 in Excel. In this mode you can create placeholders. Right click and Create Placeholder.

    So I used mode 2 and added 3 placeholders. Each placeholder has it's own Expression. This a really cool thing we can do in NAV 2013. You could i.e. also use this if you need different colors on data in one textbox.

    My 3 expressions look like this, all in one textbox which has CanGrow=True

    First Expression:
    =Code.GetData(14,1)
    & Chr(10) & Code.GetData(15,1)
    & Chr(10) & Code.GetData(16,1)
    & Chr(10) & Code.GetData(17,1)

    Second Expression:
    =iif(Code.GetData(18,1) = "","",Chr(10) & Code.GetData(18,1))

    Third Expression:
    =iif(Code.GetData(19,1) = "","",Chr(10) & Code.GetData(19,1))

    /Claus Lundstrøm
    Claus Lundstrøm | MVP | Senior Product Manager | Continia.com
    I'm blogging here:http://mibuso.com/blogs/clausl and used to blog here: http://blogs.msdn.com/nav
    I'm also offering RDLC Report Training, ping me if you are interested. Thanks to the 700 NAV developers that have now already been at my training. You know you can always call if you have any RDLC report issues :-)
  • jigneshdhandhajigneshdhandha Member Posts: 41
    Thanks clausl..
Sign In or Register to comment.