SSRS Repeating certain groups and pages - reporting-services

I'm struggling with a problem in SSRS. I have created a customer invoice that is looking good in report viewer however, it needs to be set to print in a certain way.
There are 4 main elements to this report.
Header, this needs to repeat on every other page if the invoice details + footer do not fit on the first page.
Invoice details, this needs to repeat on every other page if the invoice details and footer do not fit on the first page.
Footer, this needs to repeat on every other page if the invoice details and footer do not fit on the first page.
Back of page (payment details, like a bank statement), this needs to repeat on every other page without the header, invoice details or footer.
Is this even possible? If not, the end user has accepted that the first 3 parts of the invoice to repeat as necessary and just the last page to be the payment details.
Thanks in advance

Getting the Report Header and Footer to repeat on every page should be pretty straight forward.
Now if you have some additional information outside of the report content you wish to repeat on every page you could do the following:
As you are probably already aware, when using a Tablix it's possible to repeat table header rows on each page . This can be used to our advantage by adding Tablix with a single column and making it span the size of the page, in both the header and data rows you add rectangles so it acts like the report body. In the header row you can add any data/text you wish to repeat on the next pages.
Now as you want the back-side of the pages to have text on them, you probably don't want this to repeat on every page. Because the back of the pages is always the same static data, you could simply generate your report the way it's set up right now and insert the static page between the pages of the report.
To achive the last part you could use some code like this:
String inputFilePath1 = #""; //back of page
String inputFilePath2 = #""; //report
String outPutFilePath = #""; //final report
PDFDocument doc1 = new PDFDocument(inputFilePath1);
PDFDocument doc2 = new PDFDocument(inputFilePath2);
// Get a page from the first document. -> back of page
PDFPage page = (PDFPage)doc1.GetPage(0);
for(int i = 1; i <= doc2.PageCount; i++)
{
if (i % 2 == 1)
{
// Insert the page to the second document at specified position.
doc2.InsertPage(page, i);
}
}
// Output the new document.
doc2.Save(outPutFilePath)

Related

SSRS report tables mutiple lines not showing

I am doing Microsoft Dynmics D365 report layout. I have a table in my report that need to show the lines from the table in MS Dynamic D365. Which have only 2 lines.
D365 frontend system:
In the report layout, it is only showing the first line and the second line is not showing.
Report layout first line only showing:
I want the 2 lines to be showed in the report. I am not sure if my coding is not right or the row group that I am grouping in the report design. Please help me please. Apperciated.
here is my code in the dp class to get the table lines:
PurchPurchaseOrderTmp.MGAItemLabelName = PurchExtendedMaster.ExtName;
PurchPurchaseOrderTmp.MGAColValue1 = PurchExtended.ColValue1;
PurchPurchaseOrderTmp.MGAColValue2 = PurchExtended.ColValue2;
PurchPurchaseOrderTmp.MGAColValue3 = PurchExtended.ColValue3;
PurchPurchaseOrderTmp.MGAColValue4 = PurchExtended.ColValue4;
PurchPurchaseOrderTmp.MGALabelId = PurchExtended.LabelId;
//PurchPurchaseOrderTmp.MGALabelIdString += int2Str(PurchExtended.LabelVersion);
if (PurchPurchaseOrderTmp.MGAItemLabelName != "") {
PurchPurchaseOrderTmp.MGALabelIdString = strFmt("%1-%2",
PurchExtended.LabelId, int2Str(PurchExtended.LabelVersion));
}
else {
PurchPurchaseOrderTmp.MGALabelIdString = "";
}
Here is my report design row grouping:
Thanks
This is not really an answer at the moment as I can't see enough to be certain but...
Looking at the report design, it 'appears' that you don't have anything in the details row(s). The details group rows have been reduced in height so I'm guessing there is nothing in there.
That means that the text boxes below this must be in a group header or footer which is why they will only appear once.
The best way to get your head round this is to dump all the data from your dataset into a simple flat table, then see what you want repeating.
For exmaple, it looks like Label ID (MGAItemLabelName ?) should only be shown once, so there needs to be a group for that - which it looks like you have.
Then within that label name group, you have two rows of data that you want to show, so these must be at a lower level than their parent group. That might be the details row group, or another row group between the header and details depending on your needs.
The details row group typically contains fields that you want to show every instance of and that does not have any subordinate/child data.

Can I add Heading text to the footer in a Google Docs file automatically?

I have a document that consists of approximately 20 chapters, divided over 60 pages. Each new chapter starts at the top of a new page. What I would like to do, is to automatically add the active Chapter title to the footer of that page. I know this behavior is possible in Microsoft Word, but I can not find it in Google Docs.
It can be done manually by inserting section breaks, but that is inconvenient for me, since I want to use this process in over 1.000 different documents.
Example:
Chapter 1 is called "Test chapter" and starts at page 1
Chapter 2 is called "Another chapter" and starts at page 4
Then on page 1, 2 and 3 the footer of the page should contain the text "Test Chapter". On page 4, the footer should contain the text "Another chapter".
Thank you in advance!
Unfortunately, this still isn't available as of the moment and has no update since the issue of the bug.
I have been trying to circumvent this issue via Apps Script and never had a proper solution as the footers and headers are being treated as one.
By default, changing a footer section will apply to all footer sections, and if they were separated by section break, they are not ordered by page but by the order of them being added on the document so it would be tricky and would require you to add them in this order for my code to work.
Object Order:
After BODY_SECTION, next children of the document should be alternating HEADER_SECTION then FOOTER_SECTION.
NOTE:
Logger.log part of the code shows what is the object order of your document. If it looks like the above order, then the code below will work.
Code:
function setHeaderAsFooter() {
var d = DocumentApp.getActiveDocument();
var p = d.getBody().getParent();
for ( var i = 0; i < p.getNumChildren(); i += 1 ) {
var c = p.getChild(i);
var t = c.getType();
// Check what type is the object
// Comment out if-block below to see if what is the object order in your document
Logger.log(t);
// Every header you encounter, set it as footer value of the next object
if ( t === DocumentApp.ElementType.HEADER_SECTION) {
var f = c.getNextSibling();
f.asFooterSection().setText(c.asHeaderSection().getText());
}
}
}
If they aren't in HEADER -> FOOTER alternating order after the BODY, then the code above won't work.
Most likely, this is not the answer you were hoping for, so I do sincerely apologize. I hope that this answer will help you in any way at least.

Create word fields in python-docx to automatize footer from upon page 2 of the word document (e.g. # Page / # Total Pages)?

I'm trying to automatize a word - file generation via python docx. I created a template with the first page and its specific footers and headers; now I only need to implement this footer, starting from upon the second page:
Name Page # / Total Pages Date
all I want to know is how to configure this footer for all pages starting from the second, without influencing the headers or footers of the first page of the template. My problem is: Can I create word fields via python docx (e.g. the Pages and NumPages fields for the midpart; that's the only problem)..?
If not, can I somehow only insert the "Name" and the "Date" part into the footers from upon page 2 of the template without affecting the mid-part which I would then prepare in the template as well... ?
Attempted code on a template already containing the Pag/NumPag fields in the middle of the footer deleted the middle part (Result was a file where "Hello" was written in the lower left corner in the footer, and the Pag/NumPag of the template (Hello.docx) disappeared:
from docx import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH
doc = Document("Hello.docx")
footer = doc.sections[0].footer
parag = footer.paragraphs[0]
parag.text = "Hello"
parag.alignment = WD_ALIGN_PARAGRAPH.LEFT
parag.style = doc.styles["Footer"]
doc.save("Hello2.docx")

SSRS report total fields

How to show the total of each page in SSRS report. What I exactly mean is if pageNumber = 1 total should be sum of amount on page 1, if pageNumber = 2 total should be sum of amount of page 2 + total from page 1, etc...
.Have you tried using the running value function?
See https://msdn.microsoft.com/en-us/library/ms159136.aspx
You can also use ReportItems![CellName] to enable you to display the value in the report footer if required.
If this does not give what you require and you have a fixed page size eg A4 you can calculate the page totals and Page Numbers as a fields in your data set. This is more powerfull in settings where for example you want to print a set of customer statements in a single print run. Each customer statement would need its own page numbers and totals. Again you can use ReportItems to display these values in the relevant part of the report as they would appear at the detail level of the dataset. In this case you add a hidden field(s) containing the values you require on the detail line and pick them up using ReportItems. You can also force a page break at the end of each Page number group
To repeat the report Header / Footer on each page see this link
http://bhushan.extreme-advice.com/repeat-table-header-on-each-page-in-ssrs/.
To start with go to the footer properties and make sure repeat on first and last page is checked.

SSRS footer data based on groups

I have this report which has a group based on a field "DeliveryNumber".
It works fine, after every new DeliveryNumber the report shows new data.
But now I want to do the same with the page footer. On every group the footer should show data belonging to just that deliverynumber.
Is this possible, how to achieve this?
Assuming that you want to show Delivery number in the page footer and you have only one Delivery Number per page(i.e. there is page break after every delivery number) then in page footer you can use =ReportItems!Textbox1.Value. (Textbox1 in the expression is going to change, replace it with the textbox name in which you will keep the group header, that is Delivery Number field)
I hope this helps!