jaycee99
4th April 2008, 08:43
Do anyone of here know how to hide unwanted record from report?
For example:
Output from report:
A-Apple
B-Banana
C-Cherry
A-Apple

i do some condition where the value is equal to B-Banana then i don't want it to be displayed out. It should give me this output.

Output from report:
A-Apple
C-Cherry
A-Apple

george7a
4th April 2008, 09:29
Hi,

You can hide the whole layout, or you can hide the variable it self.

In Maintain Report Layouts, there is a field called "Output Expr" if the value of this field is 0 it will be hidden else it will be shown. Define a variable in the script and put it in this field, then you can show/hide the layout when ever you want.

Similar thing for hiding the field it self, the name of the field you should check is "Print Condition".

I hope it helps,

- George

jaycee99
4th April 2008, 09:49
I don't want to set it in print condition. How do i put it in Print Condition? Can you give me an example? Currently I write a script in the Report. Example:

select tdsls401.*
from tdsls401
where tdsls401.item = :detail.desc1

selectdo
if orno.txt3 = "SLF" AND detail.pric = 0 then
detail.desc1 = " "
endif
endselect

But there is a lot of field in a record, if i use this script it just not display the detail.desc1 but the other field like quantity, weight will be shown out. What i means is the whole record is hidden. Those that not meet the condition should be display out. Let say, if there is 10 records in a report, 2 of the 10 that meet the condition, then it should only display the other 8 records.

george7a
4th April 2008, 09:51
First, tell me, do you want to hide the whole layout? or one field?

Also check the "lattr.print" & predefined variables here:
http://www.baanboard.com/programmers_manual_baanerp_help_report_scripts_predefined_variables

jaycee99
4th April 2008, 10:16
I just want to hide the field, not layout.

bdittmar
4th April 2008, 10:18
I don't want to set it in print condition. How do i put it in Print Condition? Can you give me an example? Currently I write a script in the Report. Example:

select tdsls401.*
from tdsls401
where tdsls401.item = :detail.desc1

selectdo
if orno.txt3 = "SLF" AND detail.pric = 0 then
detail.desc1 = " "
endif
endselect

But there is a lot of field in a record, if i use this script it just not display the detail.desc1 but the other field like quantity, weight will be shown out. What i means is the whole record is hidden. Those that not meet the condition should be display out. Let say, if there is 10 records in a report, 2 of the 10 that meet the condition, then it should only display the other 8 records.

Hello,

built a flag like: extern domain tcbool prnt.field.1

select tdsls401.*
from tdsls401
where tdsls401.item = :detail.desc1

selectdo
if orno.txt3 = "SLF" AND detail.pric = 0 then
prnt.field.1 = false
else
prnt.field.1 = true
endif
endselect


and in Print condition of this field you use the flag like :

prnt.field = true

All fields in the report will be printed.
Only if the flag is set to "false" this field is not shown in report.

Regards

jaycee99
4th April 2008, 10:53
Hi Bdittmar,

Thanks for the solution. It is working now. But there is a spacing between the records. How do i move up the below record to upper row?

Example:

Before the script - the output:
A
B
C
A

After the script - the output:

A

C
A

How do i make it something like this:

A
C
A


Which mean no spacing between A and C

bdittmar
4th April 2008, 11:19
Hi Bdittmar,

Thanks for the solution. It is working now. But there is a spacing between the records. How do i move up the below record to upper row?

Example:

Before the script - the output:
A
B
C
A

After the script - the output:

A

C
A

How do i make it something like this:

A
C
A


Which mean no spacing between A and C



Use lattr.print = false in the script (detail.x)

Example:

detail.1:
before.layout:

select tdsls401.*
from tdsls401
where tdsls401.item = :detail.desc1

selectdo
if orno.txt3 = "SLF" AND detail.pric = 0 then
lattr.print = false
else
lattr.print = true
endif
endselec

The whole line is not printed !

Regards

jaycee99
4th April 2008, 11:55
I'm getting this error: External 'lattr.print' differs from global declaration.

I already declare it as:

extern domain tcbool lattr.print

and then for all the field in the report for Print Condition i change it to lattr.print=false

Must be i done somethng wrong for the script. Can u pls advice.

bdittmar
4th April 2008, 12:00
I'm getting this error: External 'lattr.print' differs from global declaration.

I already declare it as:

extern domain tcbool lattr.print

and then for all the field in the report for Print Condition i change it to lattr.print=false

Must be i done somethng wrong for the script. Can u pls advice.



Hello,

lattr. print is an internal variable, don't declare ist !

Regards

george7a
4th April 2008, 12:00
You should not declare this variable. 'lattr.print' is a predefined variable. You can check it in the list I posted earlier.

Remove the declaration and it should work.

- George

jaycee99
4th April 2008, 12:06
Hi George,

I delete off the declaration, it give me error.

george7a
4th April 2008, 12:07
Please post a screen shot of the error along with the script you are using.

jaycee99
4th April 2008, 12:09
Hi Bernd,

It was my mistake, typo error. After change, it compile successfully. But is still not shift up and giving me that spacing. Anything i have done not correct?

jaycee99
4th April 2008, 12:16
Hi George,

Attached is the information that u want. Thanks.

jaycee99
4th April 2008, 12:18
Hi Bernd,

U mean don declare it at the report script or at the Print Condition for the field? Cos when i delete off the declaration, it give me error. U can see the attach file that i already posted. Thanks.

george7a
4th April 2008, 12:21
As I understood, You want to hide one line not the whole layout. 'lattr.print' will hide the whole layout, thats why it does not work right now.

jaycee99
4th April 2008, 12:37
Hi George,

Ya, you are right. I just want to hide the line that don't meet the condition that i set and don't want all the spacing if it hide the particular line. Any idea for this?

jaycee99
4th April 2008, 12:45
Hi there,

Attached is the print screen of the report. Hopefully it will give more clear picture about what i said.

george7a
4th April 2008, 13:09
So all of your items are in one Layout? Can you post a screen shot of this layout from the Report editor?

jaycee99
4th April 2008, 13:25
Hi George,

Attached is the report editor.

george7a
4th April 2008, 13:33
As I understand from you editor, each layout contains one item. You can chose not to print this layout (or line that includes this item) by setting the "Output Expr" field (in maintain report layout) to 0. The solution is found in the second post in this thread.

Let us know if you got it working.

- George

jaycee99
4th April 2008, 13:48
Hi George,

If i put 0 for the Output Expression, all the item not display at all. The layout may contain a lot of item, cos it based on the Sales Order that maintain. If let say 5 orders in Sales Order, then 5 item will be come out at the report right. If it meet the condition that i set, then may be it will display 4 item only. So, for this case sure will have spacing in between of the item, cos 1 of the item already being hide. Any idea on this?

george7a
4th April 2008, 13:51
Hi,

As I have explained in my early post, you need to put a variable (show.layout for example) in the "Output Expr" field. This variable should be defined in your script. Then from your script you should set this variable (show.layout) to 1/0 according to your need.

- George

jaycee99
4th April 2008, 13:56
Hi George,

Can you send me the proper way on doing this? Cause i'm not familiar with the script too. Sorry for that.

george7a
4th April 2008, 14:03
You can use the same script that Brend, but change that variable to what I suggested:

select tdsls401.*
from tdsls401
where tdsls401.item = :detail.desc1

selectdo
if orno.txt3 = "SLF" AND detail.pric = 0 then
Show.Layout= false
else
Show.Layout= true
endif
endselect

You must also place the show.layout in the "Output Expr" field as in the attached screen shot.

Did it work for you?

- George

jaycee99
4th April 2008, 14:03
Hi George,

Can i use deleteln$() to delete the line without delete the record? Cos i see the description, it mentions that using this syntax, lines below the deleted ones are moved up. but i already tried this, it is not working. Maybe the way i write the script is not correct.

selectdo
if orno.txt3 = "SLF" AND detail.pric = 0 then
lattr.print.1 = false
deleteln$(1)
else
lattr.print.1 = true
endif
endselect

bdittmar
4th April 2008, 14:26
Hi George,

Attached is the report editor.


Hello,

i see, in detail.4 the lines are set to 2.

A empty line is created everytime the detail is printed.

With ESC-S you're able to bring the layout to one line.

Regards

jaycee99
7th April 2008, 04:45
Hi George,

I tried your method, it totally not displayed the line at all. But anyway thanks a lot for your suggestion. :)

jaycee99
7th April 2008, 04:48
Hi Bernd,

It's working now after i bring the layout to one line. Thanks a lot for all the information. :)

jaycee99
17th April 2008, 07:07
I just only maintain 1 item in the Sales Order. But it gave me repeated item display at the report. For example, the correct result should be like this:

Correct Result
1 ItemA

but it gave me this output:
1 ItemA
1 ItemA
1 ItemA
1 ItemA
1 ItemA
1 ItemA

It's repeating, if the repeating item i just want it to display 1 time n don't print the rest. Any solution for this?

george7a
17th April 2008, 13:56
Please post your final code and print screen of your layouts.

- George

jaycee99
18th April 2008, 04:23
The code that i write is as follow:

select tdsls401.*
from tdsls401
where tdsls401.orno = :tdsls400.orno

selectdo
pono = tdsls401.pono
endselect

Attached is the result that i get. May be i think i should put some condition at my script to not displayed the repeated line. But i donno how to do. Pls advice. Thanks.

jaycee99
18th April 2008, 04:33
But the weird thing is that when i try to reprint the Sales Order, then it give me correct output as i attached. I try to add another sales order again, it gave the repeated result, and then i try to reprint again, it gave me the correct result. That means for the first printing it sure give me the repeated result, then i have to reprint it again to get correct result. Why this happen?

george7a
18th April 2008, 14:30
The code that i write is as follow:

select tdsls401.*
from tdsls401
where tdsls401.orno = :tdsls400.orno

selectdo
pono = tdsls401.pono
endselect



Is this all your source code?

jaycee99
21st April 2008, 06:08
Hi George, yes, this is only the code. But i already solve it using grouping. Anyway thanks a lot for helping me to find out the solution.