SSRS Report Builder - Only Show Header On First Page (With Page Numbers) - sql

So I am running into the problem where my report header is being displayed on every page, but I only want to display it on the first page. The solution that people on this forum have given is to just put the header in the main content. The problem with this is that my header shows the page number + total pages (i.e. Page 1 of 3 pages). I cannot move my header to the body because I will lose access the page numbers. For some reason, Report Builder will only allow you to have access to the page numbers via the header. Does anyone have any solution to this problem?

Write an expression to hide the textboxes that hold the header information.
The expression would look like this:
=iif(Globals!PageNumber = 1, FALSE, TRUE)
To get to the expression property:
right-click text box >> text box properties >> visibility >> select "Show or hide based on expression" >> insert expression above
cheers

I had the same issue, where I only wanted the header to show on the first page. The solution I came up with was to stick all of my objects from the header into a rectangle, so it was now acting as a container. I then placed that container into the body. In the report properties, in the code section, I borrowed from this post Access Page number in report body In SSRS to create functions, which would allow me to pull the page numbers into the body section. Then in my rectangle/container, I set the visibility property to =code.PageNumber>1. I hope this helps!

I did this, just to make it easier the two functions you want to add to the Report that were linked above are,...
Function PageNumber() As String
Return Me.Report.Globals!PageNumber
End Function
Function TotalPages() As String
Return Me.Report.Globals!TotalPages
End Function

Related

How to mimic values in multi page SSRS Report

I need a lab report that has several pages. Each test has a unique reference number and I would like it to appear in the header according to what I have on the page. At the moment I only see one reference number and it remains unchanged after switching to another page. See attached image.
If possible, I would like to get rid of the SampleNo column so that its value is only in the header
The easiest way to do this is to reference the the textbox in your tablix that contains the "Sample No.".
Click the textbox that you have highlighted in the tablix, show the properties window (F4 in Visual Studio - can't remember in Report Builder, I think View/Properties).
Find the Name property of the textbox, this is often the name of the field it contains but not always.
In the example below the textbox name is 'oYear`
Next, set the expression in your header to be something like
=FIRST(ReportItems!oYear.Value)
Change oYear to whatever textbox name in your tablix is.
ReportItems refers to the rendered object name so here we just get the first on each page.
Here the first two pages from a small sample of data which groups by year.

PageNumber / TotalPages on group header in report .rdlc

I have a .rdlc report where I have no header (I have group headers)
I want to put the PageNumber on the group header.
If I use Globals!PageNumber I get this error:
The Value expression for the textrun 'Textbox12.Paragraphs[0].TextRuns[3]' refers to the global variable PageNumber or TotalPages. These global variables can be used only in the page header and page footer
Is there any way I could do this?
If there is no possibility to put this data on a group header...is there any possibility of overlap a header with the group header on a same line?
Global variables can't be used outside of the header/footer, as there is no relationship between the header/footer and body areas. Therefore, there is no easy and precise way to display the page number in the body area.
However, as suggested by user Raymond-Lee in the second link, you can try to calculate it yourself by dividing a given row number by the total number of rows per page (and adding one if the page number will always be the first row). Nonetheless, this would take a bit of effort.
First you need to have the Page Header/Footer showing, then you can add items to it. To show it, right click in the pale yellow area of the Layout view. Then select Page Header and/or Page Footer, this will create another section on your report where you can add items. Or, you can go to the Report menu option and enable the Page Header/Footer from there.
link

Is it possible to colour a cell with value from data in Cognos BI?

Let me first be clear. I'm not asking about how I do conditional formatting in Cognos BI. If there were a simple Red/Amber/Green colour scheme, based upon value ranges then I could do that. If it were a static list of colours, which never changed, I could also do that.
What I am after is accessing a hex colour code that is stored in my database, and I want to use that colour as my table cell background colour. This is something I commonly do in SSRS reports, but cannot see a method for in Cognos BI.
Is this even possible?
You can do this via the HTML object in Cognos.
The HTML object can get its definition from one of the three main ways:
1) Hard-coded text
2) Data Item Value
3) Report Expression
Obviously the first method provides no way to dynamically set the value. I couldn't get the second one to work at all. I'm not yet sure why. However, I was able to use the third type to work to allow dynamic setting of a visual style.
For the solution we'll assume you have a data item called [Color] which pulls a string value from a database in the standard hex form that is used in CSS: #xxxxxx, e.g. #CCCCCC. For the purpose of this example we'll assume it is in query Query1. The following steps describe how to set it up.
1) Add an HTML item right above your list
2) Add another HTML item at the bottom of your list
3) In the top HTML item add a span tag with a unique id such as:
<span id="list">
4) In the bottom HTML item add a closing span tag
</span>
5) Add a third HTML item before all of the other HTML items
6) Set the 'Source Type' property of the HTML item to 'Report Expression'
7) In the Report Expression put the following code:
'<style>
#list td {
background-color: ' + [Query1].[Color] + '
}
</style>'
8) Select the Page object and set the Query property to Query1
9) Click on the Properties property. Check the Color column to give the page access to that query-sourced value.
Now you can dynamically set the column color based on a database provided value. We used the span to give us a way to isolate just the table cells we want to manipulate.
The technique isn't perfect. For instance, the header cells also get their background changed to the color in question, which may or may not be desirable. This is because Cognos doesn't use the th tag for headers but instead renders them as normal cells (td).
I know it's quite and old post but just for completeness I'll add the references to get this working in html, pdf and excel.
To get this working not only for html but also for pdf and excel use a rich text item instead of a html item.
You can use following code in a query item for instance:
<span style="display:block; background-color:' + [Query Subject].[Query Item] + '"> </span>
The query item must then contain a valid color (e.g. rgb(255,0,0)) etc. which is defined by your data source.
Dragging a rich text item in a list and changing it to data item value and selecting the query item will work.
By using the span it will work for excel too, however to make sure it follows the size of the upper object in the hierarchy (the list column or a table etc) you want the display:block style.
Instead of the space in between the > < you can use any other query item that you want to appear as text.

Smartforms: form has wrong page format

SAP 730 Final Release Build 1429747 Patch Level 5
I am modifying a purchase order form; the form has a First and Next page; I added a Secondary window named 'Buyer' to both pages; before I add any elements, when I print preview the form I get the error
Form BUYER has wrong page format.
Message no. SSFCOMPOSER026
The Page Format in Form Attributes is LETTER; there is no different page format for this window.
I've read that this can be the result of some text areas containing too much text, however this window has no elements (yet).
Anyone run in to this issue before? Many thanks. I can post more info if needed.
Form TXT_CONTACT has wrong page format.
Message no. SSFCOMPOSER026
Diagnosis
Form TXT_CONTACT has a different page format than the forms output previously but has been added to the same spool request.
System Response
Form TXT_CONTACT ist not processed.
Procedure
While forms are formatted (FM SSFCOMP_OPEN to FM SSFCOMP_CLOSE), the page format must not be changed. All forms within one spool request must have the same page format.
The first page format used, in this case paper format , is applicable to all subsequent forms.

Syntax for SharePoint 2010 BCS URL Action to populate New form

Have seen several posts with solutions for native SharePoint lists, including the very useful SPUtility.js (only for native SharePoint lists). But nothing to pass a value from a BCS list to a new BCS list. The Query string filter will not connect on the New form (no web part to connect it to) and does me no good on the lists page (already have that working).
A "go write custom code for everything" is not a solution for me.
There should be a way to 1) pass the value in the URL (ideal - what's the syntax?) or 2) make some other simple change, perhaps to the select list for the item -- I just can't find it. Have seen quite a few posts with similar questions. The Microsoft documentation is not useful and there are more questions on the "social" topics than answers.
Here's what I have:
I have a BCS list (sends item) tied to a BCS related list (receives item).
I have an action on the related list (ECT) to create a new item. Works fine with no parameters. I get a blank new form. The new form allows me to enter two items and choose two items (exactly as intended).
What I would like to have is the necessary ?something=something string so that my user does not have to select one of the choice items (MNumber - set as a key / required value)
User selects "New" from Actions.
Form Opens
MNumber is automatically filled in based on the MNumber of the current item displayed in the BCS related list.
The string I supply is accepted. Does nothing.
/intake/Lists/ContactsList/NewForm.aspx
/intake/Lists/ContactsList/NewForm.aspx?MNumber=1234
The string I supply is rejected - cannot be saved or insufficient values.
/intake/Lists/ContactsList/NewForm.aspx?MHICNumber={$MHICNumber}
Have also tried passing a string to one of the text fields (instead of the select field). Can't get that to work either. I've spent quite a few hours with the various boards. Nothing helpful.
Would also be nicer if I could set the New form to display in a pop-over window (as it does when I select New from the list view). Opening a new browser window is hokey and replacing the existing one is a navigation pain for the user.
Have this working ... Thanks to Kit Menke!
Created an Action on the External Content Type in the BCS....
/intake/Lists/ContactsList/NewForm.aspx?IDnumber={0}&Source=/intake/scheduling.aspx
where
parameter property 0 is the IDNumber from the ECT
The NewForm.aspx was edited to add a hidden content editor web part with references to three scripts Kit wrote - two supporting and one that sets the values.
http://site/list/NewForm.aspx?toolpaneview=2
User selects the Action on the displayed ECT list
Action uses the URL to go to the New page with the data
Kit's script adds the data to the form and puts in the date and time.
Note: The ID field needs to be a text field. Cannot be a selection list.