BaBernd
16th March 2015, 09:56
In reports I have an Array for displaying the address of a customer. The Array has 12 lines but not all are filled. In the Report all 12 lines where listed as mask fields with the print Expression busp.fadr(1,1) up to mask field busp.fadr(1,12).
Now I would like to disable the printing of such an empty Array field. How can I do that in the field properties or in Report script?
Best Regards
Bernd
bhushanchanda
16th March 2015, 10:25
Hi,
You can use this in output expression of the layout.
busp.fadr(1,12) <> "" or not isspace(busp.fadr(1,12))
or in the report script -
layout_name.layout_number:
before.layout:
if isspace(busp.fadr(1,12) then
lattr.print = false
else
lattr.print = true
endif
BaBernd
16th March 2015, 10:48
Hello Bhushan,
that works fine. But then I have to create a Detail layout for each line?
Or do you have a solution if the lines are all in one Detail layout?
I only want to disable the empty lines not the full set of lines.
Best Regards
Bernd
bhushanchanda
16th March 2015, 10:55
Hi,
If you have use a detail layout, then in that case, you can check the array data and keep calling the detail layout until its empty using r.s.detail.x (x is the detail layout number) in your before.layout section.
e.g.
detail.1:
before.layout:
if not isspace(next_array_element) then
r.1.s.detail()
endif
or you can also use layout.again()
long ret
before.program:
ret = 1
detail.1:
before.layout:
if ret = 1 then
lattr.print = true
else
lattr.print = false
endif
after.layout:
if not isspace(next array element) then
ret = 1
layout.again()
else
ret = 2
endif
You can build your own logic this way.
Also follow this thread (http://www.baanboard.com/baanboard/showthread.php?t=39000)
BaBernd
16th March 2015, 11:37
Hello Bhushan,
thanks for fast reply. I think your first solution also will work when I fill it into the conditions of the field properties. But then I recognized that the Problem ist also the Windows size of the Detail block.
I think about such a solution:
In the before.layout section I have to Count the filled lines in the Array?
And then I should reduce the Windows size about the number of empty lines.
Is that possible? How can I count the empty lines in the Array with a simple function? Is there a function available?
Is it possible to reduce the Windows size by program code?
Best Regards
Bernd
bhushanchanda
16th March 2015, 11:54
Hi,
There is no way to handle the Window size programmatically. You can simply check the next element of the array and call the same layout again and again. Or else, create separate layouts for the address and suppress them if the value is blank.
You can code your logic. In case you face any difficulties, try debugging. If still the issue remains, you can post on the board and check if you can get some help.
BaBernd
16th March 2015, 12:18
Hi Bhushan,
thanks a lot for your help. I will do as you suggested.
So now I will Close that thread.
Best Regards
Bernd