Collapsing the space taken by hidden text
-
- Posts: 47
- Joined: Thu Dec 20, 2012 6:58 pm
Collapsing the space taken by hidden text
I have a report that uses a DataBand bound to a DataSet to show results from a database query.
In the DataBand I have a variety of text fields displaying various database fields. For example, the DataBind might contain text fields like:
Name: [FirstName] [LastName]
Occupation: [JobDesc]
Phone: [PhoneNumber]
Fax: [FaxNumber]
Where "Name:", "Occupation:", "Phone:" and "Fax" are text fields with hard-coded values while the other Text fields (e.g., [FirstName]) are displaying values from a row returned by the query to which the DataBand is bound.
Now here's my dilemma. I want to hide the phone number and occupation if there is no values present in the database. I can do this using Conditions on the "Phone:" and [PhoneNumber] text fields as well as on the "Occupation:" and [JobDesc] text fields, but what happens is that in the rendered report if there is no job or phone information it leaves a blank space there, whereas I want to collapse the report.
For example, when showing an employee that has all this information we would see:
Name: Bob Smith
Occupation: CEO
Phone: 555-5555
Fax: 555-1234
But when showing an employee that lacks a phone number I get a "blank line" for the phone number like so:
Name: Ted Stevens
Occupation: VP of Sales
Fax: 555-3234
But what I want is to collapse that blank line, so I get:
Name: Ted Stevens
Occupation: VP of Sales
Fax: 555-3234
How do I accomplish this?
Thanks
In the DataBand I have a variety of text fields displaying various database fields. For example, the DataBind might contain text fields like:
Name: [FirstName] [LastName]
Occupation: [JobDesc]
Phone: [PhoneNumber]
Fax: [FaxNumber]
Where "Name:", "Occupation:", "Phone:" and "Fax" are text fields with hard-coded values while the other Text fields (e.g., [FirstName]) are displaying values from a row returned by the query to which the DataBand is bound.
Now here's my dilemma. I want to hide the phone number and occupation if there is no values present in the database. I can do this using Conditions on the "Phone:" and [PhoneNumber] text fields as well as on the "Occupation:" and [JobDesc] text fields, but what happens is that in the rendered report if there is no job or phone information it leaves a blank space there, whereas I want to collapse the report.
For example, when showing an employee that has all this information we would see:
Name: Bob Smith
Occupation: CEO
Phone: 555-5555
Fax: 555-1234
But when showing an employee that lacks a phone number I get a "blank line" for the phone number like so:
Name: Ted Stevens
Occupation: VP of Sales
Fax: 555-3234
But what I want is to collapse that blank line, so I get:
Name: Ted Stevens
Occupation: VP of Sales
Fax: 555-3234
How do I accomplish this?
Thanks
Re: Collapsing the space taken by hidden text
Hello,
Please try to use CanShrink property and the DockStyle property, set to Top for the Text components.
Thank you.
Please try to use CanShrink property and the DockStyle property, set to Top for the Text components.
Thank you.
-
- Posts: 47
- Joined: Thu Dec 20, 2012 6:58 pm
Re: Collapsing the space taken by hidden text
I've not used the DockStyle property before, but in playing with it it seems to make all text fields full width. However, in my DataBand I have various columns, so I might show Name to the left, and Title to the right of the name, on the same line, but when I start setting the DockStyle property it makes these fields all take up an entire line.
If I try to just set DockStyle for the one field that can be hidden, it moves it to the very top.
Do you have (or can you create) a working example?
I have two scenarios:
(1) A Table of Contents-type page, where certain pages may be omitted. Specifically, my TOC has multiple lines like this:
Section 1... page number
Section 2... page number
Section 3... page number
etc.
Where each line is two fields: the name of the section and the page number it appears on. These fields are just on a report page and are hard-coded, they're not coming from a DB. But depending on certain DB values I might omit a page, in which case I can set the Section 2 name and page number to not show, for instance, but doing so renders a TOC with a gap between Section 1 and Section 3, like so:
Section 1... page number
Section 3... page number
etc.
(2) In a DataBand, based on the value in the database I may want to show a value or hide it. If I hide it, I need to compress the whitespace that would have otherwise been taken by the display. In short, I want the DataBand to skrink to the minimum height needed to display what's actually being shown.
Ideally, you guys have an existing demo (or can create one) that illustrates how to do the above.
Thanks
If I try to just set DockStyle for the one field that can be hidden, it moves it to the very top.
Do you have (or can you create) a working example?
I have two scenarios:
(1) A Table of Contents-type page, where certain pages may be omitted. Specifically, my TOC has multiple lines like this:
Section 1... page number
Section 2... page number
Section 3... page number
etc.
Where each line is two fields: the name of the section and the page number it appears on. These fields are just on a report page and are hard-coded, they're not coming from a DB. But depending on certain DB values I might omit a page, in which case I can set the Section 2 name and page number to not show, for instance, but doing so renders a TOC with a gap between Section 1 and Section 3, like so:
Section 1... page number
Section 3... page number
etc.
(2) In a DataBand, based on the value in the database I may want to show a value or hide it. If I hide it, I need to compress the whitespace that would have otherwise been taken by the display. In short, I want the DataBand to skrink to the minimum height needed to display what's actually being shown.
Ideally, you guys have an existing demo (or can create one) that illustrates how to do the above.
Thanks
Re: Collapsing the space taken by hidden text
Hello,
Please send us a sample report for analisys.
Thank you.
Please send us a sample report for analisys.
Thank you.
-
- Posts: 47
- Joined: Thu Dec 20, 2012 6:58 pm
Re: Collapsing the space taken by hidden text
Hi Aleksey. Attached is a version of the SimpleList.mrt report from the WebDemo sample project available with Stimulsoft. I did not bother attaching the entire project or the Northwind XML data since I trust you have that at the ready.
You'll see the report has two pages. The first is called TableOfContents and here I want to be able to hide certain "rows" of the TOC and have the bottom rows move up to fill the blank space. In this report I set the "Chapter 3" textbox and the "pg. 8" textboxes to not be enabled (although usually this would be done through a Condition). But when I view the report it shows the TOC with a blank where Chapter 3 was in the designer, e.g.:
If I try to set Dock to Top it won't let me align the chapter numbers and pages as I'd like.
The next issue is on the next page, titled Page1. Here there is a DataBand and in the DataBand a number of fields are displayed: Phone, ContactTitle, etc.
Now, what I want to happen is if the Region and Fax fields are empty then to suppress the space these fields would have otherwise taken (so Address would be moved up). But I can't set Dock to Top or it won't show the Region and Fax next to one another.
I hope this makes sense. Please let me know if you have any questions or any troubles loading the example report.
Thanks
You'll see the report has two pages. The first is called TableOfContents and here I want to be able to hide certain "rows" of the TOC and have the bottom rows move up to fill the blank space. In this report I set the "Chapter 3" textbox and the "pg. 8" textboxes to not be enabled (although usually this would be done through a Condition). But when I view the report it shows the TOC with a blank where Chapter 3 was in the designer, e.g.:
Code: Select all
Chapter 1 pg. 1
Chapter 2 pg. 6
Chapter 4 pg. 11
The next issue is on the next page, titled Page1. Here there is a DataBand and in the DataBand a number of fields are displayed: Phone, ContactTitle, etc.
Now, what I want to happen is if the Region and Fax fields are empty then to suppress the space these fields would have otherwise taken (so Address would be moved up). But I can't set Dock to Top or it won't show the Region and Fax next to one another.
I hope this makes sense. Please let me know if you have any questions or any troubles loading the example report.
Thanks
- Attachments
-
- SimpleList.mrt
- (22.82 KiB) Downloaded 550 times
Re: Collapsing the space taken by hidden text
Hello.
All components on the Page are static. They will not move. Please try to put them on a band.
Thank you.
All components on the Page are static. They will not move. Please try to put them on a band.
Thank you.
-
- Posts: 47
- Joined: Thu Dec 20, 2012 6:58 pm
Re: Collapsing the space taken by hidden text
The components on the first page (the Table of Contents) are static, yes, but the components in the second page are in a DataBand. Or is there some other type of band that needs to be used?
Note that for the first page (the Table of Contents) are not coming from a database, but are hard-coded (although whether or not the corresponding page is rendered is based on the data in the database).
Thanks
Note that for the first page (the Table of Contents) are not coming from a database, but are hard-coded (although whether or not the corresponding page is rendered is based on the data in the database).
Thanks
Re: Collapsing the space taken by hidden text
Hello,
Please try to place the Text component (Chapter 1, Chapter 2 ... ) on the DataBand components.
Thank you.
Please try to place the Text component (Chapter 1, Chapter 2 ... ) on the DataBand components.
Thank you.
- Attachments
-
- SimpleList.mrt
- (40.71 KiB) Downloaded 466 times
-
- Posts: 47
- Joined: Thu Dec 20, 2012 6:58 pm
Re: Collapsing the space taken by hidden text
I am confused - the report you attach doesn't have the Table of Contents.
The Table of Contents doesn't come from the database - it is hard coded. How would I put it in a Data Band?
Also, what about the second page in the report file I attached in my post on Dec 20? That is in a Data Band, but I'm not clear how I can have text boxes in the Data Band arranged in two columns yet still have blank/empty text boxes not take up any vertical space. Is this not possible with Stimulsoft?
The Table of Contents doesn't come from the database - it is hard coded. How would I put it in a Data Band?
Also, what about the second page in the report file I attached in my post on Dec 20? That is in a Data Band, but I'm not clear how I can have text boxes in the Data Band arranged in two columns yet still have blank/empty text boxes not take up any vertical space. Is this not possible with Stimulsoft?
Re: Collapsing the space taken by hidden text
Hello.
Please, watch the next tutorial video.
Thank you.
You could set the CountData property of the Data Band to 1.Scottioioio wrote:The Table of Contents doesn't come from the database - it is hard coded. How would I put it in a Data Band?
You could use Columns property of the Data Band.Scottioioio wrote:Also, what about the second page in the report file I attached in my post on Dec 20? That is in a Data Band, but I'm not clear how I can have text boxes in the Data Band arranged in two columns yet still have blank/empty text boxes not take up any vertical space. Is this not possible with Stimulsoft?
Please, watch the next tutorial video.
Thank you.