SSRS expression not displaying the right values - reporting-services

I'm trying to run the following expression:
=IIF((Fields!EntryFirstName.Value = " ") And (Fields!EntryLastName.Value = " " ),
"Team:" & Fields!TeamName.Value, Fields!EntryOrder.Value & " . "
& Fields!EntryFirstName.Value & " " & Fields!EntryLastName.Value)
The table that the following is looking at is this one :
However running the above expression will only return the following ( where EntryFirst name is the column EntryfirstName and so on):
Fields!EntryOrder.Value & " . "
& Fields!EntryFirstName.Value & " " & Fields!EntryLastName.Value
for the whole report ( this one expression is part of a row group, if that would change anything)

Related

Subform column and data change at runtime not refreshing on Form

I have Main Form in which There are Two Comobobx.
1. Type of Work (C_Art: Name of Combobox)
Repratur
Maintenance
Optimierung
2. Year (C_Year: Name of Combobox)
2018
2019
On the Main Form There is Bar chart which works perfectly and a subform with a datasheet view.
Overall it looks like .
My Problem is when I select the Year 2019 the Subform view with new header 2019-Jan 2019-Feb ......2019-Dec didn't update and the row give me error as #Name?
The Graph is generating correctly without any Problem.
I am changing the query at runtime as below.
Dim count_Status As String
Dim G_Stoerung As String
'Change the query for Graph
count_Status = "TRANSFORM Count(History_query.[LFD_NR]) AS CountOfLFD_NR " & _
" SELECT History_query.[Anlage] " & _
" FROM History_query " & _
" WHERE History_query.[Anlage] <>Null AND History_query.[WAS]= '" & Me.C_Art & "' AND History_query.[Year]= '" & Me.C_Year & "' " & _
" GROUP BY History_query.[Anlage] " & _
" PIVOT History_query.[Status] "
CurrentDb.QueryDefs("Count_Status_Anlage").sql = count_Status
'Updating the Graph with a new Data
Me.Graph9.Requery
Me!Graph9.ChartTitle.Text = Me.C_Art
'Chnage the query of subform
G_Stoerung = "TRANSFORM Count([History_query].WAS) AS CountOfWAS " & _
" SELECT [History_query].Status " & _
" FROM History_query " & _
" WHERE ((([History_query].WAS)= '" & Me.C_Art & "' ) AND [History_query].Status IN ('Offen','beobachten','In bearbeitung','erledigt') ) " & _
" GROUP BY Status " & _
" Order by (IIf([Status]='Offen',1,IIf([Status]='beobachten',2,IIf([Status]='In bearbeitung',3,IIf([Status]='erledigt',4))))) " & _
" PIVOT Format([Datum],'yyyy-mmm') IN ('" & Me.C_Year & "-Jan','" & Me.C_Year & "-Feb','" & Me.C_Year & "-Mar','" & Me.C_Year & "-Apr','" & Me.C_Year & "-May','" & Me.C_Year & "-Jun','" & Me.C_Year & "-Jul','" & Me.C_Year & "-Aug','" & Me.C_Year & "-Sep','" & Me.C_Year & "-Oct','" & Me.C_Year & "-Nov','" & Me.C_Year & "-Dec') "
CurrentDb.QueryDefs("G_Stoerung_query").sql = G_Stoerung
'Updating the subform with new Data
Me.G_Stoerung_Sub.Form.RecordSource = G_Stoerung
Me.G_Stoerung_Sub.Form.Requery
The #NAME? error would be because textboxes are no longer bound to fields that exist. Make the field names generic and apply filter parameter for year. Or set the subform container SourceObject property to query object instead of form
Edit
G_Stoerung_Sub.SourceObject = ""
G_Stoerung_Sub.SourceObject = "Query.G_Stoerung_query"
updating the source object gives desired result.

Is possible to concatenate multible fields with one that is a conditional iif statement

I'm working on an ssrs report using Report builder 2008, currently trying to concatenate using something like this but when I do so, I receive an error for the field 'lifeamount' specifying that the expression can only refer to fields within the current dataset scope. I've tried different ways to specify the dataset which is the same for all the fields but to no avail. Is this even possible?
=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " & rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " & rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " & IIF((Fields!Lifeamount.Value)> 100000.00, 100000.00, Fields!lifeamount.value, "EmployeeInfo"))
SSRS expressions are case sensitive which means that your second lifeamount reference is more than likely wrong.
Try this instead:
=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " &
rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " &
rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " &
IIF((Fields!Lifeamount.Value)> 100000.00, 100000.00, Fields!Lifeamount.value, "EmployeeInfo"))
If the expression is located in a cell that is within the same scope as the details you are fetching (i.e. "EmployeeInfo") then I don't think you need to specify it at all.
Also there are some brackets out of place I think. I can't test it at the moment but try this...
=rtrim(First(Fields!FRSTNAME.Value,"EmployeeInfo")) & " " &
rtrim(First(Fields!MIDLNAME.Value, "EmployeeInfo")) & " " &
rtrim(First(Fields!LASTNAME.Value, "EmployeeInfo")) & " " &
IIF((Fields!Lifeamount.Value, "EmployeeInfo")> 100000.00, 100000.00, (Fields!Lifeamount.value, "EmployeeInfo"))

Need to format code for querying with exact value from combo box

I have the following ms access query. I want it to query with the gender (female or male) selected from the combo box. At the moment, when I select "female", the query results also includes all male persons.
How should I format this code:
WHERE (((Q_Gender_Statistics.Year) Like [cboYear] & "*") AND ((Q_Gender_Statistics.Gender) Like "*" & [cboGender] & "*"))
Don't use Like if not needed:
" WHERE Q_Gender_Statistics.Year = " & [cboYear] & " AND Q_Gender_Statistics.Gender = '" & [cboGender] & "'"
If cboGender looks up "Male/Female" form an index value, try this:
" WHERE Q_Gender_Statistics.Year = " & [cboYear] & " AND Q_Gender_Statistics.Gender = " & [cboGender] & ""

Using DCount function with a query linked to a control

The following code is giving me a syntax error message. I would like to use the DCount function on the current event of a form to count records in a table where the value on the control 'TeamID' is equal to that in field 'teamID' in the table 'tblCompetency06'
Me.etcRecordNumber.Caption = "Record " & Me.CurrentRecord & " of " & DCount("ID", "tblCompetency06") WHERE [tblcompetency06].[teamID]= '" & me.Teamid & "'"
There could be two reasons, one you are using the wrong syntax for DCount. Second you are using/comparing a Number data type and you are comparing with a String. Try the following.
Me.etcRecordNumber.Caption = "Record " & Me.CurrentRecord & " of " & _
DCount("*", "tblCompetency06", "[teamID]= " & me.Teamid)

Trying to replace a certain character in SSRS

I am trying to replace a the charater 0 when pulling through a report. I have entered the expression below and when I run my report I get a #Error any hints on what I am doing wrong?
Thanks
=IIf(Fields!HomeAddress2.Value & " " & Fields!HomeAddress3.Value & " " &Fields!HomeAddress4.Value = 0, Fields!HomeAddress2.Value & " " & Fields!HomeAddress3.Value & " " &Fields!HomeAddress4.Value, "")
Isn't it similar to NULL?
Maybe you can try ISNULL( <your expression>, " ")