Author |
Message |
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
|
Topic: suppress column based on value of 1 field Posted: 09 Dec 2013 at 10:15pm |
Hi all,
I want to suppress an entire column, based on the value in row 1. If I add the recordnumber it only counts for that specific record, not for everything.
I want to suppress everything, except when the first row contains a certain value.
Thanks in advance.
Kind regards
Gerben
|
IP Logged |
|
Sastry
Moderator
Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
|
Posted: 09 Dec 2013 at 10:30pm |
Hi
Create below formula and place in it in required section .
Whileprintingrecords; Numbervar x:=X+1;
Now right click on the column (which you want to suppress) go in Format Field--Common--Suppress-- Condition formula editor and give below formula
Whileprintingrecords; Numbervar x;
If x>1 then true else false
|
Thanks,
Sastry
|
IP Logged |
|
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
|
Posted: 09 Dec 2013 at 11:13pm |
Hi Sastry,
This is just showing everything, no matter the value in the first line. I want to suppress the entire column, based on the value of the first column.
Example:
The data looks like this (this is without headers):
Recordnumber Service Amount
2 Wash 10.00
3 Clean 5.00
I only want to show the entire column if the first row contains the words service or amount. This should result in the data showing like:
Service Amount
Wash 10.00
Clean 5.00
Hope this makes any sense
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 10 Dec 2013 at 4:49am |
create a formula, I would put in the report header, like:
shared booleanvar showRow := false;
if {table.field} in ['Service','Amount'] then
showRow := true;
"" //hide the formula output.
now in the column detail section, in the suppress x-1 button:
shared booleanvar showRow;
not showRow;
this will suppress the column based on the value in the first row of the data.
HTH
|
IP Logged |
|
Sastry
Moderator
Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
|
Posted: 10 Dec 2013 at 6:51pm |
Hi
There are two ways of doing it, one could be of extracting first row field value through Add Command( Free hand SQL)
Second would be of inserting same report as a sub report in report header section.
If you insert sub report, use shared variables and pass first record information to your main report, based on this information you can suppress the column.
|
Thanks,
Sastry
|
IP Logged |
|
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
|
Posted: 10 Dec 2013 at 10:03pm |
Hi,
I ended up using a different method. I created a formula called 'Suppress saying if {table.field} in ['Service','Amount'] then 1 else 0.
In my suppress formula, I said count({@Suppress}) = 0
|
IP Logged |
|
Sastry
Moderator
Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
|
Posted: 11 Dec 2013 at 6:36pm |
Hi Gurbs, Excellent ! Thanks for sharing this.
|
Thanks,
Sastry
|
IP Logged |
|
Gurbs
Senior Member
Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
|
Posted: 11 Dec 2013 at 9:08pm |
Sorry, I see I made a small mistake... it isn't count({@Suppress}) = 0, but sum({@Suppress}) = 0
|
IP Logged |
|
|