Textbox in Reporting Services - show text or hyperlink - reporting-services

I have a report in SQL Server Reporting Services which should show
a text box with a static text for "normal" users
a text box with a hyperlink to open up a new details windows for "super" users
The user level is determined by a parameter being passed into the report.
How can I achieve this? I tried to create a textbox with a text span inside that has a hyperlink, and then just leave it blank for "normal" users, but that doesn't seem to work reliably.
Is there a trick or method to get this to work? I'm thinking I need to add some code to the report to check the user level and then either insert a static text, or a text with a label, into that target textbox. But how do I do that (not having any VB/VBA/VB.NET experience....)
Thanks!
Marc

To make the hyperlink, you should be able to use an expression like
=iif(Parameters!IsSuperUser.Value = True, "http://some link","#")
in the Action property of the textbox, if you set the Action to "Jump to URL".
To control the content of the textbox, use a similar expression in the Value property.
(This is true on SSRS 2005 - I don't have access to 2008)
Edit
Unfortunately, hyperlinks in SSRS aren't formatted in a way to make it clear that they're hyperlinks. The only way to achieve this would be to add similar conditional formatting expression to the Color and TextDecoration attributes to make the field appear in a different colour and underlined when it is a hyperlink.

I haven't got SSRS installed on the machine that i'm writing this on so i can't give you an exact guaranteed bug free answer, but this answer should set you on the right track.
Have two textboxes, both located in the same absolute position (inside a container element if necessary). Fill them both with their correct values. Then just control their visibility by toggling their Hidden property with an expression:
=(Parameters!UserLevel.Value = 'Admin')
Obviously UserLevel is the name of the parameter being passed in to the report. The 'Admin' value is for illustrative purposes, personally i would use an int value to represent the user level, much like using an enum.
Remember that it is the Hidden property you are setting, so you have to reverse the logic you would have used if you were setting a Visible property :)

Related

Hyperlink control in Access App

I've created a hyperlink control on a form page in an Access 2013 App hosted in SharePoint 2013, and want the text to display the same text ("Print Timesheet") while the actual link itself varies based on the value of a field in the record. This is so that I can link to a separate application using a query string with the individual record ID, which gets the data directly from the azure database and formats it in order to be printed out.
I've tried a macro expression to create the link address that runs "on current" and sets the value of the hyperlink, and also tried a computed column in the table to create the link which I pass to the hyperlink control value. I've set the "Default Display Text" on the hyperlink control to "Print Timesheet" in both cases.
The problem I have is that whichever way I try it, changing the value on the fly like this overrides the default display text of the hyperlink so that it displays the address itself rather than the text I want to display.
Is there any way round this?
Thanks,
Duncan
I am not sure if you got your answers. I was randomly looking on internet and found your query.
I thought the thread Troubles with Hyperlink control in Access Web App forms may have your answer.
LILizEidsness replied on August 21, 2014See post history
.....
If you have to build a url field dynamically, the basic syntax is
displaytext#url#
so, in my dynamic field....
=Concat("Click here#/relative/path/on/my/sharepointsite/allitems.aspx&ID=",[ID],"#")
....
You could use a label on the form to represent the link. Have the Label.Caption property set to "Print Timesheet" and use the On Current event to set the Label.HyperlinkAddress property to whatever the address from the recordsource is.

Reporting services 2008 textbox labels

Im creating a report in RS2008.
Everytime I create a textbox and write an expression, instead of watching the expression text after I change focus of the element I get the following tag: <<Expr>>.
I'm used to creating reports on RS2005 and if in a textbox I wrote ="Hello", for example, once I change focus it will display ="Hello" not <<Expr>>.
Its probably a setting but I can't find how to change it.
I don't think you can change this - it's by design in SSRS 2008.
I would say the reasoning behind it is that you can now have multiple placeholders in one Textbox and it's easier to represent with multiple <<Expr>> values:
For text and basic field values, these will not have <<Expr>> displayed.
If you change basic text from ="Hello" to just Hello that's what will be displayed in the designer:
And an expression like =Fields!val1.Value will be displayed like this in the designer:
It's jarring at first but you get used to it.

Changing the text in an SSRS report textbox based on the toggle state of a row group

Apparently this should have been simple. After lots of digging, I'm yet to find anything that works. I have a row group in my SSRS report whose visibility is toggled by a textbox. What I want is to have the text Show in the textbox when it's collapsed, and Hide when it's expanded.
But I can't find any property of the group that can give me its toggle state. I have found in a few forums that it's not possible. As a workaround, I've tried the InScope() function ( as suggested in http://forums.asp.net/t/1601570.aspx/1). But to no avail. Can anyone suggest anything?
I believe you are correct in stating that SSRS does not expose the ToggleState property for use in the report.
In these types of situations, I use report parameters to control the state of the report. For example, you could add a parameter named isGroupVisible to the report with a default value of 1 to represent visible. Set your group's visibility to that parameter, and set your text box value conditioned on the state of isGroupVisible. Then in the text box you set your actions to be go to a report, and set the report url to be the same report with the isGroupVisible = to the opposite of what it currently is.
You can decorate your text box all you want to give the users the indication that it can be pressed to toggle the state of the report.
Draw backs to this approach is that it isn't as snappy as the ajax calls SSRS does to expand visibility--it will post back to the server on each toggle press.
Advantages to this approach include much more flexibility in controlling the state of the report.

Bug re-enables a TextBox if it has Cond. Formatting?

I think I'm looking directly at an Access 2003 bug. Here's what I did (I think):
I'm developing a Continuous Form (i.e. multiple records per page).
I have an unbound textbox in the background of the Details section. Under Data Properties, I have Enabled=No and Locked=Yes. (In other words, I don't want the user to select it. I only want it for the background color)
This textbox also has some conditional formatting to change the background color for that row. (e.g. If we haven't spoken to that customer in awhile, the background for that record is red)
If I choose a record where the conditional formatting is active (i.e. the background is red), I can actually click on this textbox. There's not much that I can do, of course, but this shouldn't happen and surely would be confusing to the end-users.
Has anyone else seen this? What's your workaround?
Enabled is a property that can be controlled via conditional formatting. By default when you add a new condition, the Enabled property is set to True. If you don't want your control to be enabled you must explicitly set Enabled = False within the conditional formatting rule.
The property is toggled via a button in the lower right corner of the conditional formatting dialog. It's easy to miss (I forget about it all the time).
Personally, I think the property should be three-way: True, False, or Inherit (with Inherit as the default). Unfortunately, Access forces you to be explicit when adding conditional formatting rules and state whether the rule should make the control Enabled or Disabled.
Here's my workaround (I was waiting to see if anyone else would suggest something better. Apparently not.)
In my conditionally formatted textbox, add an Event Procedure for GotFocus. Enter this code: Me.Txt_FocusHere.SetFocus.
Make a 2nd unbound text box somewhere on the form. Shrink it until it's just 1 line thick. Call it Txt_FocusHere.
So whenever the user clicks on the colored background, the focus is immediately taken to this dummy textbox which can't store any data and is so small that the user doesn't see the blinking cursor.
I successfully used the method on the following page: http://www.mvps.org/access/forms/frm0047.htm - "Changing the Background Color of the Current Record in a Continuous Form"

How to reference a control's properties in Access

For instance, I have a query which takes as a parameter the text property of a drop-down box [DDB1] of Form1.
How do I reference the property?
My stumbling around google has suggested that it should be something along the lines of
Forms![Form1]![DDB1].text
But I have been unable to find a definitive syntax for such references.
Any ideas?
Semi- OT - the Access2003 help, which contains links to a lot of Microsoft web pages, returns a lot of 404s when trying to load them. Is this just coincidence? Or end-of-lifing by stealth?'
To have a query reference a combo box on a form, use this syntax:
Forms!MyForm!MyComboBox
This will retrieve the selected value property of the combo box (the value of the first column, if it is a multi-column combo box).
If you want the selected value of a different column in the combo box, it is:
Forms!MyForm!MyComboBox.column(n)
Unlike most numeric indexes in VBA, n is zero based (the second column is 1).
To reference the text property, the combo box must have the focus.
The help file is apparently suffering from link rot. Here are some links in MSDN to use:
Access 2003 Programming Reference
http://msdn.microsoft.com/en-us/library/aa167788(office.11).aspx
Access 2003 Language Reference
http://msdn.microsoft.com/en-us/library/aa663079(office.11).aspx
You have in fact multiple ways to refer to a control with MS-Access. In addition to #Robert Harvey proposal, you can also write:
forms(myFormName).controls(myControlName)
Despite what #Robert says, you can access most properties of a control without setting the focus on it. One important exception is the ".text" property, which refer to the text appearing in the control, and where the focus must be set to the corresponding control.
Most of the time, the .text property is equal to the .value property, that can be accessed without setting focus on the control.
Thus, this property is useful only for controls of the combobox or listbox type, where the bound column (that gives the .value property) differs from the displayed column (giving the .text property).