How do you dynamically merge columns in SSRS 2005/2008

I am using Table to generate my report in SSRS. I want to merge the columns based on the data returned in the dataset. How can I do that  or that's possible? (each row of the data contains the number of columns to merge)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Megan BrooksSQL Server ConsultantCommented:
Cell merging is done in the XML report definition and I don't see any way to do it on the fly. In SSRS 2008 you can reliably hide and show columns dynamically, using the Column Visibility property (an expression). You can hide a column even if it contains merged cells, and even if it contains the first cell of a series of merged cells (the merged cells in the set that are in visible columns continue to be visible and to merge).

I don't know exactly what you want to do, but I can tell you that column hiding in SSRS 2008 is quite flexible. If you want certain cells to appear one way (merged/not merged) at one time and another at another time, you might define two sets of columns and hide one or the other.
xyzluckyAuthor Commented:
I have a table that represents a monthly calendar that has 7 days columns. Each row detail is a task for a given day that can last one or more days so I want the detail text data to start on certain day and span to multiple days dynamically (prefer but don't know how to do) or I just can duplicate rows and show/hide the rows (tedious but doable)
Megan BrooksSQL Server ConsultantCommented:
I see. That would be a lot of hidden rows. Three things come to mind:
  1. Show the task information in just one of the cells, and "join" the cells on each row visually by hiding the border line between associated cells. You can provide a separate expression to set the border color of each border on each textbox.
  2. Draw the calendar using a stacked bar chart. I don't know if the chart properties can be fine-tuned to make it look like a calendar or not, but at least it does provide a way to divide several horizontal bars of the same total width into arbitrary-width segments.
  3. Use a 3rd-party component, commercial or free, if you can find one that has this feature (I am not familiar with any of them).
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

xyzluckyAuthor Commented:
Your suggestion #1 is good but how do I get the text to span to the next col(s)?. I find that its annoying that SSRS does not provide things like colspan or rowspan properties..
Megan BrooksSQL Server ConsultantCommented:
That is the drawback with the first suggestion. You can make the cells appear as if they are merged, but the actual text still has to appear within the boundaries of a single cell.
I think they just had to draw the line somewhere on features, and a calendar is probably more of a chart than a report anyway. A calendar chart type would be nice to have, and Dundas does have one but it hasn't found its way so far into SSRS as delivered.
There are new formatting features in SSRS 2008 R2, but I am not sure yet what they can do.
If you are really determined, you can merge cells dynamically by generating the RDL on the fly. That might turn out to be a fairly involved solution, though.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xyzluckyAuthor Commented:
I need to get this done so I finally decided to just duplicate rows (in my case I have 28 rows)  and show/hhide the row based on the number of days the task spans. That works well.

Thanks for the comment/suggestion.
Irene LiCommented:
Thanks xyzlucky! Your solution just saved my day!
Megan BrooksSQL Server ConsultantCommented:
Yes, I like that solution too. 6 1/2 years later. Wow.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.