How to generate sequence numbers in ssrs report - reporting-services

I want to generate sequence numbers in sssrs report as given in following image.
Is it possible to generate these numbers in ssrs report?

Initially add a column to your table which will store the calculation of the row number and make it hidden
You can use RunningValue with DistinctCount for each group in order to get the group number.
The expression will be like those below (heading, group, category, title)
= RunningValue(Fields!heading.Value, CountDistinct, "DataSet1")
= RunningValue(Fields!groups.Value, CountDistinct, "table1_Group1")
= RunningValue(Fields!category.Value, CountDistinct, "table1_Group2")
= RunningValue(Fields!title.Value, CountDistinct, "table1_Group3")
Your number column expression will look like those below (textbox1 contains the row number for heading, textbox16 for groups, ...)
= ReportItems!textbox1.value
= Reportitems!textbox1.Value & "." & Reportitems!textbox16.Value
= Reportitems!textbox1.Value & "." & Reportitems!textbox16.Value & "." & Reportitems!textbox22.Value
= Reportitems!textbox1.Value & "." & Reportitems!textbox16.Value & "." & Reportitems!textbox22.Value & "." & Reportitems!textbox4.Value

You can insert in RowNumber(Nothing) in each group header. Hope it helps.
Reference: How to add it each group header - http://www.sqlcircuit.com/2013/08/ssrs-how-to-implement-alternate.html

Related

Can't get syntax correct for DCount with multiple criteria

My table is tbl_WCCSRQA, the relevant fields are CustomerServiceRep and Claim Date.
My form that passes the variables is called frm_CSRErrorTracking, and the relevant boxes are called CSRNameCB (a combo box), and StartDate EndDate (both are text boxes)
My report is called rpt_CSRErrorTracking and I want to set the DCount as a control source for a textbox called TotalClaims
I need a DCount that counts all instance of a CustomerServiceRep name between two dates. I'd like to pass the Name and Dates from my form. I'd like to set the DCount as a control source for the textbox on the report
Here is the DCount I have tried so far;
=DCount("CustomerServiceRep", "tbl_WCCSRQA", "CustomerServiceRep = '" & [Forms]![frm_CSRErrorTracking]![CSRNameCB] & "'" AND "ClaimDate = '" BETWEEN [FORMS]![frm_CSRErrorTracking]![StartDate] AND [FORMS]![frm_CSRErrorTracking]![EndDate]"'"
I've looked at this for the past 30 minutes and cannot figure out where I am going wrong. I continue to get the error message "You may have entered an operand without an operator".
You have a few double quotes out of sync - try the following:
=DCount("CustomerServiceRep", "tbl_WCCSRQA", "CustomerServiceRep = '" & [Forms]![frm_CSRErrorTracking]![CSRNameCB] & "' AND ClaimDate BETWEEN #" & Format([FORMS]![frm_CSRErrorTracking]![StartDate],"yyyy-mm-dd") & "# AND #" & Format([FORMS]![frm_CSRErrorTracking]![EndDate],"yyyy-mm-dd") & "#")

Is is possible to add in more information retrieved after a Lookupset call in SSRS?

I have 2 datasets from which I populate my report, ActiveProjects (primary dataset) & ActiveTasks. I use the expression:
=Join(lookUpset(Fields!Title.Value, Fields!Related_Project.Value, "" & Fields!Title.Value & "", "TeamTasks"), "<br> <br>")
This works great for retrieving each task grouped with its related project and it also includes a dynamic URL to the respective tasks.
My question is: Is it possible to include additional pieces of information (such as TargetDate - which is in the ActiveTasks Dataset) to be placed alongside the Task in the same Column & Row (Otherwise it wont remain aligned as the Task list goes on, since they are of varying length, while the date is not) ?
Ideally, it would return something like this:
Project Title Task Title
_______________|_________________
Project A | Task a 12/12/16
| Task b 02/12/16
| Task c 28/11/16
Project B | Task a 22/11/16
|
Thanks in advance and sorry if this has been addressed before!
Try:
=Join(
lookUpset(
Fields!Title.Value, Fields!Related_Project.Value,
"<a href = " & Chr(34) & "https://example" & Fields!ID.Value & Chr(34) &
">" & Fields!Title.Value & "</a>" & " " & Fields!TargetDate.Value , "TeamTasks"
),
"<br> <br>"
)
Also you may want to format your date, so you can use FORMAT(Fields!TargetDate.Value,"dd/MM/yyyy") inside a LookupSet function.
It is not tested but should work.
Let me know if this helps.

DCount will nor return 0 but returns Error instead

Test = DCount("*", "tblWorkNew", "GP = " & GPID & " And Month = #" & Month & "#")
This function gives correct results when the answer is >0. Whenever it's 0, I get #Error. I have tried putting my code within a Nz but that doesn't help either.
I tried to duplicate on a Northwind db what I believe you are trying to do. I used the Order List form. In the header of that form I created a textbox named txtMonth. The Control Source for txtMonth is =Month([Order Date]). Then I created another textbox in the header named txtMonthOrders with Control Source as =GetMonthSum(). Then I created a function in Modules called GetMonthSum(). This is the function: GetMonthSum = DCount("[Order ID]", "Order Summary", "Month([Order Date]) = '" & Forms![Order List]!txtMonth & "'") . This seems to work.

Combining 3 strings in Access VBA

I have a form that filters data by user, date range and specific value for a column, depending if checkbox is ticked or not, as below;
strWhere = " WHERE [user] in (" & Left(strIN, Len(strIN) - 1) & ") And [Month] Between [forms]![frm_user]![txtStartDate] And [forms]![frm_user]![txtEndDate]"
If Me!checkbox = True Then
strtcheck = " (Satified Vs Dissatisfied Like Dissatisfied) "
End If
strSql = strSql & strwhere & strtcheck
So what I want and I can't get it to work is, if Me!checkbox is true, than the Satified Vs Dissatisfied must be equal to Dissatisfied and then I want to pass it to the strSql, however when i run it in Access it doesn't work, can someone help?
If your string is intended to include a WHERE condition for a field named Satified Vs Dissatisfied, enclose the field name in square brackets. And enclose the string you compare to the field in quotes.
strtcheck = " ([Satified Vs Dissatisfied] Like 'Dissatisfied') "
Actually that condition doesn't use pattern matching, so you could just use = instead of Like.
strtcheck = " ([Satified Vs Dissatisfied] = 'Dissatisfied') "
Also you likely need to include SQL AND to combine that condition with the other WHERE conditions.
strtcheck = " AND ([Satified Vs Dissatisfied] = 'Dissatisfied') "

DSum with date criteria

I need to count the number of shifts worked by people over the last twelve months. I want to use DateSerial. My code works if I input an actual date, not DateSerial. I tested my code by changing DateSerial to return a date other than twelve months ago but my code always gives the figure for the sum of all data - going back more than twelve months. So it ignores MyDt. Where am I going wrong?
Public Function Shifts() As Integer
Dim MyDt As Date
MyDt = DateSerial(Year(Date), Month(Date) - 12, 1) - 1
Shifts = DSum("Shifts", "tblWorkNew", "GP = " & GPLookup & "And Month > #31/10/2012#") 'This works for any date.
Shifts = DSum("Shifts", "tblWorkNew", "GP = " & GPLookup & "And Month > " & MyDt) 'This only gives all data, i.e. ignores MyDt
End Function
MyDt is Date/Time, but you include it as a string in your DSum criteria argument. So transform the value to a string which the db engine recognizes as the date you intend.
Shifts = DSum("Shifts", "tblWorkNew", _
"GP = " & GPLookup & _
" And [Month] > " & Format(MyDt, "\#yyyy-mm-dd\#"))
I added a space before And because it looked like there was one missing. I assumed Month is the name of a field in your tblWorkNew table, so enclosed it in square brackets to inform the db engine you don't want the Month() function instead.