SSRS - Display a text based on first row value - reporting-services

I am trying to write an expression, If the result-set's first row values is equal to 1 then display a text. I am not sure how to get first rows value. Can someone help me out to achieve the same.
=IIF(Fields!IsAccessAvailable.Value=1, "You have full access to this page","")

=IIF(First(Fields!IsAccessAvailable.Value, "YourDatasetName")="1",You have full access to this page","")
You could also add the same expression as Textbox Visibility, so that if Fields!IsAccessAvailable.Value = 1 then and then only this textbox will be shown else it will hide it.

Related

SSRS hiding a row group if there are no detail rows

Can someone please help me write a custom code that will check if the details of the row group = nothing? I'd like to use this as a show/hide expression such that table 0 will not display if there are no records within the group.
I can't seem to use aggregations for the row group details at the row group level.
Edit:
example 1 with a detail row
example 2 with without a detail row but the group header still displays. I'd like to hide this group completely:
OK, so it looks like you want to hide a table, not just a group within a table.
If this is not correct , please post your full report design.
You should be able to just count the rows in the dataset that the table is bound to.
So if your table is bound to `DataSet`` the 'Hidden' property would just be
=COUNTROWS("DataSet1") = 0
"DataSet1" is the name of the dataset, it is case sensitive and must be enclosed in double quotes.
The table will be hidden but the space it consumes will not be used, in other words, you will have a blank space where the table should be.
Alternatively, you can set the NoRowsMessage property to simple text message or an expression which will be displayed instead of just hiding the table.
I ended up using an IIF(IsNothing(Fields!MyField.Value), Parameters!ShowMissingGroup.Value,False) for the row group expression visibility then using a parameter to hide/show it.

Autofilling my form in Access with the use of a Combo Box

I'm having a problem when I want to autofill my form in Microsoft Access. The idea is that I use a combo box to select a name. Then the onChange code of my Combobox automaticlly inserts all the other data in the proper field. I use this code on the Combo Box.
Private Sub cmbName_Change()
Me.tbPersonalNumber = Me.cmbName.Column(0)
Me.tbEmailadress = Me.cmbName.Column(2)
Me.tbBirthday = Me.cmbName.Column(3)
End Sub
This methode works fine for the personalnumber and the emailadress. But it doesn't work for the birthday date, it returns a null value but when I check my table there is is a date in the proper field.
Am I missing something? I tried everything but it wont work.
I was thinking that the problem is related to the birthday column being the last in the table. Or having the date type.
Thank you in advance for your time and efford!
Edit; The .Column(1) is missing because this is the name that is already inserted with the ComboBox.
There is some confusion caused by the wording of the question, I'll try to state back how I've interpreted and if I have it right it may lead you to an answer.
You have combo box called cmdName that is pre-populated with data from a table. The content of the combo box could look as below (you may have set column widths to zero to hide the data)
0001|Gary Evans|gary#email.com|01/Jan/1970
0002|J Rommers |JR#email.com |02/Jan/1970
When the user selects J Rommers Me.tbPersonalNumber is populated with Me.cmbName.Column(0) (0002) and Me.tbEmailadress is populated with Me.cmbName.Column(2) (JR#email.com) but Me.tbBirthday is not being populated with Me.cmbName.Column(3) (02/Jan/1970).
Assuming Me.tbBirthday is a text box with no code that might clear it out, I suspect the issue is within the combo box. Not being sure how your combo box is set up, I would suggets the following checks:-
In the combo box properties, does the Column Count equal 4?
In debug, with a breakpoint on Me.tbBirthday = Me.cmbName.Column(3), does it show you the date you are after?
If it is not there does the query that populates the combo box have it in?
Edit based on comments to help further: -
Change the query to SELECT Personel.PersonalNumber, Personel.Emailadress, Personel.Birthday, Personel.Name FROM Personel ORDER BY Personel.Name; this puts all the fields you want hidden at the front.
Change the column widths property of cmbName to 0,0,0, this first the ones you want hidden and leave the last one to fill the width of the combo box.
Ensure the column count property is still 4 as per the answer
Change your code as per below and Gustav's answer
Replacement code:-
Me.tbPersonalNumber = Me.cmbName.Column(0)
Me.tbEmailadress = Me.cmbName.Column(1)
Me.tbBirthday = DateValue(Me.cmbName.Column(2))
This accounts for the fields moving in the query and ensure the date shows as a date like you wanted.
Comboboxes (and Listboxes) always return a string, so convert that to a Date value:
Me!tbBirthday.Value = DateValue(Me!cmbName.Column(3))

show/hide columns in SSRS report 2012 based on Multiselect parameter

i have been trying to hide/show columns within my tablix based on multi value parameter , but whenever i am plugging in the expression in the column visibility properties it is not showing what i select from the parameter and hide what is not select.
Here is the expression:
=IIF(InStr(JOIN(Parameters!parameter.Value,", "),"value"),false,true)
any help???
If I understand correctly, you want to show the column if you select a value which contains "value". Right?
So the expression should be like below:
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,false,true)
I always get this wrong too. I think backwards. It is actually asking for the expression that will hide the column. SO Black_T is correct with his answer.
=IIF(InStr(JOIN(Parameters!Parameter.Value,","),"value")>0,false, true)
so whenever the expression picks up that value in the statement, it will return false, meaning that it should not hide it, and whenever it doesn't find it, well the returned product will also hide it! pretty ingenious!
Thanks and enjoy!
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,true,false)

SSRS validating parameters and stopping report

So I have two combo boxes, box1 and box2. The requirement from within SSRS is if box1 is selected set Box2 to None and if box2 is selected then set box1 to none. Now I don't think this is possible because you can only cascade parameters in one direction. Otherwise you get forward dependencies are not valid.
But the question becomes can I validate the boxes when they click View Report to display a msgbox saying Please either choose box1 or box 2 but not both
Note: I am still working in 2005.
As far as I know, View button code cannot be accessed. As a workaround, you can do the following:
Add a textbox in your report and let the text be something like "Please enter either cmb1 or cmb2" .
Now from the Database check if both Values are entered. If yes, just return the columns in your select statement as NULLs or specify a value e.g. EMP_NO = 9999.
In your report if the returned value for EMP_NO is 9999 by checking FIRST(fields!xx.value ) = 9999 you can determine what did the user enter.
Add an condition to the textbox visibility checking if the value is 9999 or not, do the same for other items in the report to hide them and just show the textbox.
This can be used for other validations as well.

Assign value to cell in column depending on name of column - matrix

I have a matrix that dynamically displays columns and rows. (dûh)
I will always have a (dynamic) column with the name 'Everyone'.
Now I am looking to color those cells green that have value > 0 AND columname 'Everyone'
I think I should be doing something with a IIF statement but how do I find the name of the column for a specific cell?
Thanks for thinking with me!
Henro
You can check if a column is in scope of a group (a column/row group) using an InScope expression - you should be able to do this on the background colour expression of the offending cell
How is the column defined? Is it using a grouping or are you adding a static column using the advanced editor? Either way you should be able to use the InScope function to check if the cell belongs to a certain column
e.g.
=iif(someColumn.Value > 0 AND InScope("ColumnGroup"), "Green", Nothing)
Give a bit more info on the groups/layout and I might be able to help a bit more