How to concatenate IIF statements with vbcrlf? - reporting-services

How do I get this expression to work in SSRS? I'm trying to get the field value, and if it is blank then to skip it and go to the next one.
Any help is appreciated.
=IIF(IsNothing(Fields!street1.Value), "", Fields!street1.Value) & vbcrlf & And
(IIF(IsNothing(Fields!street2.Value), "", Fields!street2.Value) & vbcrlf & And
(IIF(IsNothing(Fields!street3.Value), "", Fields!street3.Value)))
INPUT:
Street 1: Text 1
Street 2: null
Street 3: Text 2
Desired OUTPUT:
Text 1
Text 2

You can put your VBCRLF inside your IIF statements:
=IIF(IsNothing(Fields!street1.Value), "", Fields!street1.Value & vbcrlf) &
IIF(IsNothing(Fields!street2.Value), "", Fields!street2.Value & vbcrlf) &
IIF(IsNothing(Fields!street3.Value), "", Fields!street3.Value)

Related

SSRS Choose Parameter to Show in Header

I have a report for my customers where they can input a Premise Number, Tax ID, Service Number, or Address to search by. I've set these four options as my parameters.
I'd like to show whichever they have selected in my header. Right now, my header looks like this;
Service for
Premise: __whatever they select__
Tax ID:
Service ID:
Address:
Expression Code looks like this;
="BACKFLOW SERVICE / DEVICES / TESTS" & vbcrlf &
"for Premise#: " & Parameters!premise.Value & vbcrlf &
"for Tax Parcel ID: " & Parameters!TaxParcelID.Value & vbcrlf &
"for Premise-Svc: " & Parameters!SvcNum.Value & vbcrlf &
"for Address: " & Parameters!SvcAddr.Value
But, instead, I would like for my header to only show whatever they've selected. If they're searching by address, I'd like for my header to say;
Service for
Address: ___address here___
How can I do that?
You can do this by checking the parameters for values with an IIF Statement. You can do something like what is below.
="Service for " & vbcrlf &
IIF(ISnothing(Parameters!premise.Value), '', "for Premise#: " & Parameters!premise.Value & vbcrlf) &
IIF(ISnothing(Parameters!TaxParcelID.Value), '', "for Tax Parcel ID: " & Parameters!TaxParcelID.Value & vbcrlf) &
IIF(ISnothing(Parameters!SvcNum.Value), '', "for Premise-Svc: " & Parameters!SvcNum.Value & vbcrlf) &
IIF(ISnothing(Parameters!SvcAddr.Value), '',"for Address: " & Parameters!SvcAddr.Value)

VBA JSON PUT request with concatenation

This is how I am constructing my JSON array to be sent via the PUT method where I am taking some cell value from excel:
body = "{""note"":""" & Cells(RowNote, 3).Value & """,""uniqueIdentifier:""" & Cells(RowNote, 2).Value & ",""IdentifierType"":""ACCOUNT_ID"",""CustomerId"":" & userID & "}"
However i got an error 13 mismatch.
This is an example of the JSON string that can be PUT correctly:
{"note":"call again", "uniqueIdentifier":1716, IdentifierType":"ACCOUNT_ID", "CustomerId":927560}
What should be corrected within the brackets?
Try body = "{""note"":""" & Cells(RowNote, 3).Value & """,""uniqueIdentifier"":" & Cells(RowNote, 2).Value & ",""IdentifierType"":""ACCOUNT_ID"",""CustomerId"":" & UserId & "}" if you do not want " around your integers.

Microsoft Access 2010: ComboBox text extraction / search

I have a text search in my form, which uses the following code to filter my table of staff data:
Private Sub Command71_Click()
DoCmd.ApplyFilter "", _
"[Forename] Like '*" & [Forms]![StaffTotalQuery]![StaffTotalSearchText] & "*'" & _
"Or [Surname] Like '*" & [Forms]![StaffTotalQuery]![StaffTotalSearchText] & "*'" & _
"Or [ResearchArea]. Like '*" & [Forms]![StaffTotalQuery]![StaffTotalSearchText] & "*'" & _
"Or [Skills] Like '*" & [Forms]![StaffTotalQuery]![StaffTotalSearchText] & "*'" & _
"Or [EndDate] Like '*" & [Forms]![StaffTotalQuery]![StaffTotalSearchText] & "*'"
End Sub
The search works for all fields apart from [ResearchArea].
Both ResearchArea and Skills are ComboBoxes on my split form.
Both ResearchArea and Skills are fields in my Staff table.
New Skills can be added in the split form, but new ResearchArea's can only be added in the table.
The drop-down box on the Skills ComboBox contains repeated entries( e.g. if my listed skills on five staff are: "", "", "", "Accounting", "Accounting", then these options will appear in the drop-box), and blanks. I'd like it only to show unique entries, but also for me to be able to create new ones in this split form.
I'd also like to be able to search all staff's ResearchArea's, which I could do if they were text (like "Forename").
You have a dot to remove on this line:
"Or [ResearchArea]. Like '*" & [Forms]![StaffTotalQuery]![StaffTotalSearchText] & "*'" & _
Aside, you cannot search dates - in a meaningful way - as you do.

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] & ""

I'm combining fields in an access query and I need the last number to show a certain number of digits

Current code is:
[Plant] & "" & [CurrentYear] & "" & [CurrentMonth] & "" & [ID]
This gives me LO14A2, where [Plant]=LO, [CurrentYear]=14, [CurrentMonth]=A, [ID]=2 but [ID] is supposed to be 00002. What should I have the format as?
Try
Right("00000" & [ID],5)
So:
[Plant] & [CurrentYear] & [CurrentMonth] & Right("00000" & [ID],5)