convert parameter to int in Stimulsoft mrt

You can use standard C# function in Stimulsoft .MRT report although I have not seen them in documents as such. For example if you want to add two parameter values in Stimulsoft MRT Report, you will have to convert them to integer first. By default they are of “Object” type.

In the following example, I am converting @Month object into an integer. It must first be converted to string using ToString() and then use Int32.Parse() function to convert it.

This variable can then be added to another variable (concatenation) as

Int32.Parse(DataSource1.Parameters[“@num1”].ParameterValue.ToString()) + Int32.Parse(DataSource1.Parameters[“@numb”].ParameterValue.ToString())

How to enable disable a page in Stimulsoft

Diable Page in Stimulsoft MRT

Stimulsoft allows you to enable/disable a page based on a parameter. For example you want to print one type receipt for one department and another type of receipt for another department, you can do that by creating two pages and enable/disable each page based on a paramater in this case department ID.

In my case, I am passing a parameter name @page. If if pass 1, it hides page 1 and show only page 2 (no condition is given to page).


Help on the same topic from Stimulsoft

Stimulsoft Report Multiple Queries with different Parameters

Lets say I have two queries in my stimulsoft (.mrt) report.

In Stimulsoft Report for this to work correct, Query1 which takes 3 arguments must come first than Query2, for the report to work correct. You can move Query (DataSource) up and own by selecting the query first and the click up and own arrow at the top.

How to troubleshoot your Stimulsoft Report

The most common scenario that you will have to troubleshoot is are parameters passed correctly the queries? To do that simply drag all parameters from the queries on to the report area, one in each line and then print the report. See which value is not passed or has incorrect value.

Remove unwanted Columns, data, text from Stimulsoft

It happens that out of a blue a new column appears in the report or some text that is hidden under some control and appears only in the report and not in the design. What I found works in such case is drag the control and while it is being dragged, see what is underneath it. Another thing I found use, is change page size, this give you more area to look at. You might find controls that you can see in your regular pagelayout, once you spot it, remove it and change your layout back to your regular page size. I had a couple of reports that I had to clean this way.

Decimal value is automatically rounded off in Stimulsoft Fixed

stimulsoft automatic rounding

stimulsoft automatic rounding

I had a database field Qty which which was showing as integer in Stimulsoft MRT report but the value was actually of type double (decimal value). I played with formatting and added two decimal places to the number by right clicking the field and selecting “Text Format”. That added decimals but now the numbers were showing as 2.00, 5.00 etc. For example, 1.35 would be showing as 1.00 and 3.6 would be showing as 4.00. It turned out that I needed to change the data type in Stimulsoft SQL query.

To fix it, right click on the database field in the right side and select edit. This should popup the dialog above. Notice that the value here was int and hence rounding to x.00. Change this to decimal and the problem should be fixed. It is important that double value here may not work (may not show actually decimal numbers)!

Repro Steps

This problem actually started because the original SQL query was pulling Qty as integer which was later changed to double. After changing the field type, it needed to be updated in Stimulsoft report as well.

Here are some related links that I got some help from

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Stimulsoft

When you run your query, it might run just find but in your stimulsoft report you might get this error. The error could arise from mismatch of parameter or parameter not giving in the URL or too many parameters given. In my case the error was really dump. I was referencing a report that did not exists. That is my report was refering to report1new.mrt which did not exist. I should have been referring to report1.mrt instead. After fixing this error went away.

Hope it helps someone else! A simple spelling mistake!