We continue to consider useful tips for beginners when creating reports in Microsoft Reporting Services.
Start can be found here:
Microsoft Reporting Services tips for beginners.Interested, please under the cat ...
0) How to place several controls in a table cell?
Quite often it becomes necessary to place several controls in 1 table cell. If you simply drag the control to the cell, it fills it completely. The control called Rectangle helps to get out of this situation.

Rectangle is an analogue of the Panel control used in WinForms, it is a kind of platform for placing controls. When placed in a cell, the Rectangle fills the entire table cell creating a βpadβ for placing the rest of the controls.

')
1) Set the default report language
When creating reports, try to declare the report language (Report Properties - Language).

This is very useful if you work with a foreign client whose regional settings differ from yours. If you do not know what settings your client is using, then you can specify Expression with the following content:
=User!Language
This will avoid irregularities in the formatting of numerical values, dates, times, currencies, etc. that the client expects.
2) String concatenation
Sometimes it becomes necessary to βinsertβ into static report text, for example, placed in the texbox, field value from the database. In other words, you need to add text lines to 1 line. For this SSRS provides operand β&β.
Suppose we have static text in the texbox
Β«, . β¦Β».
We need instead of Ivan Ivanovich substitute name from the database, from the field fio. To do this, right-click on the texbox, call the context menu, select the Expression property from the texbox and change the text as follows:
=β , . β & Fields!fio.Value & β β¦β
upd: As suggested by the respected
pokryshkin in comments, a more correct way to concatenate strings is to use placeholder.
Using it is simple: in texbox, you need to set the cursor to the place where you want to insert a value from the database field. Right-click the context menu and select "Create placeholder ..."

Set the Label value (this value will be visible in the text, if you do not specify a value for the Lable field, then the field name from the database will be used) and Value (in our case, this field is from the database)

The use of placeholder offers additional benefits:
1) You can see the text that is in control (in the method that I described, the user sees only the text
<>
, which introduces a person who sees the report code for the first time in confusion and spends his time searching for the desired Expression.)
2) Placeholder allows you to format the field (set the data format, change the font, color, alignment, etc.) without changing the formatting of the main text.

The difference "on the face":

3) Ways to format numeric data
SSRS provides several options for formatting data. The easiest way to format is to specify the format (the Format property) in the properties of the control.

This method has 2 drawbacks:
1) the control contains, in addition to the data that is supposed to be formatted, additional text.
2) when exporting a report to hml
This problem can be solved by calling special methods. Consider an example:
The textbox contains the following text: β , : β & Fields!UserBalance.Value & β .β
.
If you do not produce formatting, then provided that the value of Fields! UserBalance.Value is 1005.35, it can be displayed to the user as 1005.350000000000. To avoid such an incident, you must use the Format or FormatNumber method .
Example of use: β , β & Format(Fields!UserBalance.Value,β
β , β & FormaNumber(Fields!UserBalance.Value,2) & β .β
When using Format, you must use a formatting mask; when using FormaNumber, it is enough to specify the number of decimal places.
Note: The Format method is also used for formatting dates, times, money, etc.
4) Export report to hml format setting fields
SSRS allows you to export a report in different formats, one of which is CML. Each report control has 3 properties that are responsible for the behavior when exporting to hml.

Consider them closer:
DataElementName - is responsible for the name of the element in the hml, the default value is not satisfied. If you do not execute this element, the name in the hml will correspond to the name of the control.
DataElementOutput - the property is responsible for whether the element will be exported to HML or not. Values ββthat can be set:
Auto (default value) - the item will be exported if it has a value, if it is null, it is not exported.
Output - the item is always exported.
NoOutput - the item is not exported to hml
DataElementStyle - is responsible for the style of the element in the hml (it will be an element or an attribute)
Values ββthat can be used:
Auto (default value) - depending on the control, it will be exported as an element (node) or attribute (attribute). In fact, only the default texbox is exported as an attribute, the remaining items are in the form of nodes.
Attribute - the value will be represented as an attribute
Element - the value will be represented as an element (node)
An important trick: the Hidden property does not apply to export to hml. Therefore, if you intend to export an element in hml that is shown or not based on a condition, then this condition must be transferred to the Expression control. Example: a textbox contains text that is displayed only when the condition = 1 field. Then the Expression will look like this:
=IIF(Fields!Condition.Value = 1, βSome textβ,ββ)
That's all for now, to be continued.