Copy and paste a table (tablix) in SSRS
Asked Answered
P

4

32

I have a tablix that has data for one day, and I need to have the same data at the bottom but in 3 different lines. I'd like to copy the main day table 3 times at the bottom, and then use different datasets for each one.

I tried copying the tablix and pasting it into the Body beneath the tablix, but I get the following error:

Report Builder was unable to paste successfully.

How can I accomplish the copy and paste? Or if that isn't possible, is there another way to do what I am trying to accomplish?

Here's an animated screenshot:

Example

Publicist answered 11/8, 2014 at 21:6 Comment(2)
Hey, this is happens because VS doesn't rename textboxes with expr on the fly, and that is why u have this error, but yet I didn't find a solution for that, did u?Bank
upvoted because of the animated screenshot!!!Pareto
B
31

You are likely getting the error message Report Builder was unable to paste successfully because somewhere in the grid there is a cell that uses Custom Code From the Report

i.e. you cannot copy a textbox with this custom code: “Code.MyCustomeCode()”
- Report Builder was unable to paste successfully

This has been a reported bug since SSRS 2008:

When using Visual Studio 2008 to create new reports, we cannot copy and paste multiple textboxes in a tablix, and receive a popup error stating "Report Builder was unable to paste successfully"
- Unable to copy and paste textboxes in SSRS reports with Custom Code after 2008 R2 SP2 upgrade

Workaround:

  1. Open up the XML view for the report, either in Visual Studio by right clicking the report and selecting View Code, or by editing in any text editor.
  2. Comment out Code. blocks. Ctrl + F your way through the document looking for Code.. The goal is to preserve the code in some way, while temporarily commenting out the line. Depending on your actual code, this might be different, but I here's what I like to do:
    • Find:               =Code.
    • Replace With: ='Code.
  3. Go back to the Designer View and Copy and Paste the Tablix. You can do this by right clicking the top left corner of the tablix control:
    Copy Tablix
  4. Go back to the XML View and reverse the find and replace
    • Find:                ='Code.
    • Replace With: =Code.

You should be all set!

Note: You cannot just copy the <tablix> block in the XML view after step 1 because it will create elements with the same exact name property

Brainy answered 11/12, 2014 at 13:48 Comment(0)
U
20

Alternatively, you can just add a comment AFTER your code like so:

'custom code comment

Then you can copy and paste it as normal, without having to remove your comment afterwards or comment out your code beforehand.

Uprear answered 28/4, 2015 at 16:26 Comment(6)
Wow, how did you figure this out? Thanks heaps!!Evania
@Evania Wish I could take credit for it, but it was just a ton of copies where some worked and others failed. Took a lot of trial and error figuring out what it was.Uprear
This is old, but this is fantastic to know. Real time saver.Retrospective
Do you add this after the actual code block for the report, or in the expression that uses the code?Outwardly
Add the comment in the expression itself. I just tried it on a tablix having like 10 code calls and voila, I was able to copy/paste it once I threw in a dummy comment on the end. Great find!!Implied
T H A N K Y O U!Lamkin
V
0

I encountered this issue, and I noticed that this bug occurred when there is a Code reference anywhere in the report, and is not limited to the copied fields.

Vinavinaceous answered 11/5, 2017 at 18:52 Comment(0)
C
0

In the last case, if nothing works for you:

  1. You can copy and paste the tale(Tablix 1 to tablix2)
  2. Delete all custom expressions in the new tablix (tablix2)
  3. Get inside each textbox tablix1, copy the code
  4. Get inside the new textbox (tablix2) and paste

I know it seems too much work, but it can help.

Controvert answered 27/10, 2023 at 15:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.