Skip to main content
Solved

Hide a text field with a condition in report designer


Is it possible to put in a condition to not display a text field in the page header section if the results is in the detail section?

I have tried different conditions but it only seems to work when I put the condition in the details section, but this results in the text field being added per line.

 

So when I run the report and there are no lines to display currently the heading still displays:

 

 here is an example of when there are lines to display:

 

 

19 replies

Userlevel 7
Badge +5

Hi @francoisroux96 

You can create conditions for text fields as follows: IIf( [SOLine.InventoryID] = NULL , ' ' , 'OUT OF STOCK (Not Invoiced)' )

 

Best Regards,

NNT

Userlevel 1
Badge

Hi, I tried your formula but it still shows the text

result:

 

 

Userlevel 7
Badge +5

Hi @francoisroux96 

Please test again as shown below

 

Best Regards,

NNT

Userlevel 1
Badge

I have put in your formula as suggested but I still get the text field displayed

 

Result:

 

 

Userlevel 7
Badge +5

Hi @francoisroux96 

Have you done “Save To Server” in Report Designer yet?


and click "Reload this page" on the website before doing "RUN REPORT"

 

Best Regards,

NNT

Userlevel 1
Badge

Hi, Yes I have done that. I have attached the report if you would like to see as well

Badge +12

One way to do this would be to add a variable to the header section, called LineCount or something. In the details, increment the variable according to your conditions. Then use the LineCount variable in your header visibility condition, something like: IIf($LineCount > 0, True, False)

Userlevel 4
Badge +1

I have tried different conditions but it only seems to work when I put the condition in the details section, but this results in the text field being added per line.

 

 

One way to do this would be to add a variable to the header section, called LineCount or something. In the details, increment the variable according to your conditions. Then use the LineCount variable in your header visibility condition, something like: IIf($LineCount > 0, True, False)

 

This happened with a client recently. They wanted the header to change depending on the detail in the report, but Acumatica evaluates/prints the header before it evaluates the detail.

So I did a combination of both of the above suggestions:

  1. I duplicated the detail section and put the header in the first line (where I know it will evaluate)
  2. I added a variable to count every line that meets the criteria (e.g. Iif([SOLine.InventoryID]=null,0,1) + $LineCount)
  3. I added a visibility formula to the header in the detail section: $LineCount=1. That forces the header to only show once if/when you have an out-of-stock item
Userlevel 7
Badge +5

Hi @francoisroux96 

Please "Save as" to .rpx and attach the .rpx file again.

 

Best Regards,

NNT

Userlevel 1
Badge

Here you go 

Userlevel 1
Badge

attached rpx format

Userlevel 7
Badge +5

Hi @francoisroux96 

Please see the attached .rpx report file that I have edited.

In the screenshots below, I tested the case there are lines and the other case there are no lines.

 

 

Best Regards,

NNT

Userlevel 1
Badge

Hi NNT,

 

Thanks for this but the result is still the same. I am wondering if it does not have to do with the details section visible expression. which is =[SOLine.ShippedQty] < [SOLine.OrderQty] and [SOLine.IsStockItem] and [Branch.BranchCD]<> 'BOSWINKEL'

 

we are basically saying if the shipped quantity is less than the order quantity to show the items that were not delivered/out of stock. Without this all the items are displayed, when i add it it displays the items correctly when there is no items to display but then it still shows the header

 

with no stock

 

 without no stock

Saved to server, refreshed screen, checked it was the right version.

Userlevel 3
Badge

@francoisroux96 Could you try just putting the same visibility expression on the page header section? That way when the detail section is not visible, the page header section is also not visible.

Userlevel 3
Badge

@francoisroux96 Nevermind, that doesn’t work. I added something to your relationship between SOOrder and SOLine and added a visibility restriction on the page header, it should be working now. 

Attached is the report

Userlevel 7
Badge +5

Hi @francoisroux96 

Please see DrewNisle's handling above. I found it worked well.

 

Best Regards,

NNT

Userlevel 1
Badge

Hi Guys, that worked great, Thank you so much for all the help so far.

 

When there was  stock that could not be delivered:

when all the stock was delivered:

 

 

If  I want to use this as a sub report on my invoices screen SO643000 it should be independent from the main report right?

I added it to the SO643000 report here:

 

I added a visible expression to only show if is it stock items, I noticed if I don’t put that in the sub will display non stock items like delivery, so with this expression it solves that issue

If i run the report for an invoice that had all the stock it displays correctly without the header:

When I run the report where there was stock not available it shows the stock not delivered but not the header:

 

 

Could it be that the sub is referencing from SOLine but the main report does not have SOLine in a join? or is this another case of adding a visible expression to the main report as well?

Userlevel 3
Badge

@francoisroux96 Turns out, page headers do not get passed through a subreport. I also found out that visible expressions on group headers are also bugged, but I found a workaround. If you join your SOOrder table to SOLine on the SO643000 Report using the same relations as the subreport, you can then apply the same visible expression as before. 

=IIf([SOLine.InventoryID]=null Or [Branch.BranchCD] = 'BOSWINKEL',false,true)

Then add the header as a group header instead of a page header. I updated the subreport attached below. 

With Backordered parts

 

Without Backordered parts

 

Userlevel 1
Badge

Hi Drew, 

 

Thank you that worked, the main invoice display is perfect now

Reply