SSRS report, is there a way to switch templates based on configuration? - sql

I have been googling for a good description of this but am not having much luck. I am pretty new to SSRS reports and I am probably not using the correct terminology here. If someone could point me towards an article that describes this that would suffice.
Basically I want to pull a bit into my report, and based on the value of that bit (or maybe a varchar) I want to render an address in different formats, or add/remove some sections completely form the report. I suspect this is basic functionality but am having trouble finding an example. Any help would be appreciated!
Thanks!

If you have a table/matrix the best place to put stuff like this is in columns that are outside of the detail or any groups at the top of the table. You can merge all the cells and add rectangles to add specific formatting. The neat part about using header columns is they can be hidden and the space used will not be rendered.
Say you have a table and Row1 and Row2 contain different formatting of the same data. If you have a report parameter named ShowFormat1 then you can optionally hide/show the correct row with formatting.
Click Row one and Set its Hidden property to =!Parameters!ShowFormat1.Value
Click Row two and Set its Hidden property to =Parameters!ShowFormat1.Value
The same concept can be applied to all elements if you are not using a table or matrix. Non-repeating controls, Rectangle or Image for example, can be hidden but the space used will still be rendered.

Related

SSRS Reporting - How do you prevent a page break before a row in a Tablix?

I have a tablix that contains a fair bit of verbiage. There are other tablix that contain a user defined amount of information. The tablix that contains the large amount of verbiage comes afterwards. Upon printing the report, the row of the tablix that contains the large amount of verbiage will push to the next page every time. I am looking to prevent this from happening.
I am not using Row Groups.
I have set the Page break options to Keep together on one possible checked and unchecked.
I found putting the tablix inside a text box helps control this. See below:
Another thing that helps is applying filters to the row to handle how many results are displayed. See below:
This should prevent the page over flowing onto the next. To fit as much data as possible on the page you can always change font size or squeeze everything closer together.
Hope this helps.
Thanks
Gav

SSRS Report Builder Design Layout Issues

I can't seem to figure out why the design aspect of Report Builder/Report Designer is so messed up. Either I don't understand why it is doing this (most likely) or this is just the way it is.
Every Element I add to my report seems to not show up, align or look correct in the actual preview. If I add a line that snaps to another line which looks correct in design, looks totally incorrect in the final version. This is just one example of many, see below for images showing this behavior.
If I have a field (text box) tied to a data set and I position it in a certain area, it creates weird white space, is centered wrong or worse, when re-positioning the aforementioned line element, it seems to move other nearby elements in some erratic way. In the obfuscated example, the carrier fields are all basically stacked on top of each other, while in the preview they are spaced properly, but further down in the document if I do the same thing it ends up looking drastically different.
Is this a bug? Is this how RDL and Report Designer work? Is there some trick to element positioning? Is it relative to other elements, based off of foreground vs back ground elements? Does copying a text box to create more text boxes affect them in some way vs. creating a new element each time? I can't figure it out and do not know what to search for to find the answer to this.
This seems to be a "quirk" of how Report Designer works and I just haven't found the secret to it yet. If there is some exact positioning dialog available, I would prefer to use it instead of my mouse and these issues as I have a down-to-the-MM spec document for how this should be designed, but I cannot figure it out.
I am using Report Builder 14 for SQL Server 2016. It is a one page form (an ASN label) held within a table and all elements are within a rectangle element.
Is there an online resource or Report Designer guru who can point me in the right direction when it comes to this?
Example of the vertical line element looking incorrect in Preview/Final
Example of the vertical line element looking correct in Design View
EDIT: Like HOW does this even make sense?
SSRS renders so that the elements do not overlapp. In addition every element get enough space, vertical and horizontal. Basically you cant control this but there is a workaround.
If you put a rectangle in your report and place textboxes in that rectangle, they get rendered like you placed them. This also works in a tablix cell.
Another solution for your problem would be to display everything in one tablix cell. Your expression would be looking like this:
="Ship to: " & Fields!Adress.Value & ". Postal Code: " & Fields!PostalCode.Value
You even can add line breaks and tabs into that expression.

Checkboxes to generate letter

I am currently building a User form for some letters we use at work and I would like to design the userform to generate the letter with mostly just checkboxes. e.g.
Your application cannot be completed until the following is received:
A Statutory declaration providing a statement in regards to your: financial situation
In the above example I would need two checkboxes.
Checkbox 1:
A statutory declaration providing a statement in regards to your:
Checkbox2:
financial situation
I guess the question I am asking is in two parts:
1: How do I get checkboxes to generate text?
2: How do I get multiple checkboxes to generate text against the same bookmark/s?
I may not need a Statutory Declaration, I may need a "certified copy of:" ---"bank details, proof of identity, proof of citizenship"
As you can tell from the user form it's pretty extensive and all the checkboxes in the lower half of the form need to generate text.
Grateful for any advice or direction or resources or anything.
In theory, you might store the text to be inserted in your letter in the Check box's caption property and use code to insert the text into your letter when the box is checked. I think this is cumbersome and recommend that you use the caption for a caption, for example, "Statutory declaration". If it is checked such a paragraph is inserted into the letter, else it is left out.
The required declaration may include one or several of many items. Since you are thinking of check boxes, you could have one for each "bank details", "proof of identity", "proof of citizenship". These selections are very short and could be placed in the caption property. But if the texts are longer or of greatly varying lengths I would recommend the use of text boxes instead. So, if Cbx1 is clicked, the text of Tbx1 is inserted etc.
Alternatively, if only one item is required you might consider a dropdown. Or you might use a list box with multiple choices. In principle, I think that using different systems for different levels of decision making helps the user to find his way through your form. For example, use check boxes to select paragraphs (the full text of which might be shown in adjacent text boxes), and then switch to list boxes, option buttons, dropdowns or check boxes which look completely different to specify the contents of the selected paragraph. All of that detail might as well be hidden until the user has checked its box.

Report studio: keep list in one page in pdf

I have this list on a report that exceeds one page because it has a lot of rows. Instead of having it split into two pages I want the second part of the list to appear next to the first part, all in the same page. Both in html and pdf.
Disabled break and horizontal pagination in the list properties but did not work. Also put page break in report properties. It did improve the amount of rows that fit now but I still need to put one half of the list next to each other because I do not want it to split in many pages. Maybe there is another solution you know of.
Thanks for your help!
I'll post this from what I got to contribute if someone is looking for something similar.
If you know the amount of rows you can use a "newspaper" style report. Look it up, you'll find it simple.
Another option is to use repeater tables. I went for this one because my amount of rows was dinamic.
Hope this helps.
Regards

Best way to select from a list - aren't the two listboxes getting a little old?

How many times have we seen this type of selector:
List Box Selector http://geekswithblogs.net/images/geekswithblogs_net/dotNETvinz/MoveItemsListBox.jpg
I was just about to start creating this in a WinForms app, when I thought that others may have some ideas for doing this better. We need it to sort - so the right hand list will need up/down buttons. But this seems so old school. I love devexpress components, and was thinking of asking them if they would consider adding a component that handles this functionality with a slick UI.
I am thinking that a graphical representation of the objects, and a graphical representation of the listboxes - that would be a more intuitive way to move items around.
Has anyone seen an open source project like this?
If a CheckListBox won't suffice (and it usually will), then the "modern" approach would be to use a ListView or similar component with a "Transfer" column. Render the button inline in that column, one for each row, so that it only takes one click to move an item from one to the other.
You see this everywhere in Vista, usually with hyperlinks as opposed to buttons. Instead of clicking on an item and then choosing an action, you click the action at the item level.
I wouldn't go overboard with slickness as it can impair functionality, but the dual-listbox screen is definitely old-school.
Also, if there's a very large amount of data to manage, it helps to provide a progressive search at the bottom of one or both lists.
I have done this type of selection using (essentially) a single CheckListBox that displays each item as an image. Part of the image looks like a LED, which is on (bright) if the item is selected or off (dark) if it is not selected.
This works well if you have a reasonable amount of data to select from, and also works well in a multi-column format if you can predict that the options will have reasonably similar lengths.
Allow users to drag items in/out of list 2, and also drag to reorder in list2.
(All items dragged out of list2, and dropped anywhere outside the list, get put back into list 1, in their correct place in the list by alphabetical or natural order.)
You can merge the two list boxes into one with the help of groups (LVGF_GROUPID flag): one group for selected and one for not selected.
You can also implement group membership changes with drag-drop between them. This way single drag-drop can move an item into the other group at the appropriate position, saving most/all of the other buttons.
Additionaly the bottom of each group can have one pseudo item with help text (i.e. "Drag items here to...") that is visible only when relevant.