SQL server report builder show text box only if a field is blank - sql

I have several text boxes that display information that the field cannot display.
Now when there is data in the field, I don't want the textboxes to display their extra information. Is there a visibility expression that makes it so the textboxes are only displayed if the field is blank or 0.00?
Edit:
The text box ("TxtCycleTime13") expressions are: "=IIf((Fields!PartNum.Value Like "16THW-PIF"), "24.0", "0.00")" right now - This makes the text boxes display 24.0 whenever a part number starts with 16THW-PIF
The text box ("TxtCycleTime13") visibility expression are: "=Iif(ReportItems!TxtCycleTime13.Value = "0.00", True, False)" right now. - This makes the text box show ONLY if it has 24.0 (or in other words, if only the part number is 16THW-PIF)
Thanks!

True in the expression specifies Hidden, so if the expression returns true the text box will not show. To invert this you would simply swap the True and False:
=Iif(ReportItems!TxtCycleTime13.Value = "0.00", False, True)
This will only show the textbox if the value is 0.
If you want to check a field instead of the existing textbox, just reference it instead;
=Iif(Fields!CycleTime.Value = "0.00", False, True)

Related

Getting typed OR selected value from combo box

I have a combo box (myCB) in a form. The user can either select a drop down value or type a value in the box. When the user clicks a button, I want to get the value in the combo box for use in a query.
I am using myCB.Column(0) to grab the value. This works if the user has clicked a selection in the combo box. However, if the user has typed the value, then myCB.Column(0) is null. I have also tried myCB.Text and myCB.Value. Both give null.
How can I grab the combo box value regardless of whether it was selected or typed?
Edited to add properties:
Row Source: "SELECT DISTINCT Item FROM tblItems" (this is set in VBA code, and not in property sheet)
Bound Column: 1
Column Count: 1
Column Widths:
Control Source: ItemName
Figured it out. I was grabbing the combo box value after DoCmd.GoToRecord , "", acNewRec in the OnClick procedure, and the behavior was wonky. Running the value-testing stuff before a new record is accessed yields the correct behavior. Thank you everyone for your help.

Remove textbox when field is empty

I'm trying to hide a textbox when the field is empty, but it's not working:
IIf(IsNothing(First(Fields!Fld27.Value, "P2BDataSet")),true,False)
Try this in the text box visibility property
iif(Fields!YouField.Value>0, false, true)
If you still you did not get what you want, check How to Hide RDLC Textbox Based on Value

hiding a textbox if text value is null

I have done a research on this but can't seem to find a convincing answer. Here is the scenario. I am doing a reporting application in rdlc. I am getting field values from my database and displaying in the text boxes. Please see below what I display in the report
Textbox1
Textbox2
Textbox3
In case the value of text box 2 or any other text box is null, I don't display the same using the formular
iif(fields!Textbox2.value is nothing, false, true)
for example this is what I get
Textbox1
Textbox3
with a space between textbox1 and textbox3. I dont want this space to appear incase the value is null. How can I handle this? Thank you
If you're using a simple TextBox you have to set Visibility and CanShrink property.
If you're using a TextBox in a Table/Tablix you have to set Visibility property of the entire TableRow containing the TextBox.

Hide text box based on parameter values

Hope someone can help as I am quite new to SSRS, I am trying to hide a text box that has an expression in it. When multiple values from a drop down parameter are selected I want to hide the box but when only one option is selected I want to show just the one option.
I currently have a text box with the following expression in it
=First(Fields!Name.Value, "ABC")
The above currently shows the first Value from a field which is correct, but when as I said there are more values selected, I want to hide this, I am not sure if I need to wrap the above expression in something or change this in the Text Box properties under visibility
I have been trying to add the following expression under the Text Box Properties/Visibility option, but not having much luck
=Iif(Parameters!Supplier.IsMultiValue > 1, True, False)
I am using SSRS 2012 though I am sure what I am trying to do is quite easily done in every other version.
Hope someone can help, P
As a multi value parameter is an array, you need to use a formula like this:
=Iif(Parameters!Supplier.Value.Length > 1, True, False)
or as suggested by the OP
=Iif(Parameters!Supplier.Count > 1, True, False)

Create masked textbox but hide masked characters when empty

I want to validate text taken from a textbox and display it in a specific format.
I have tried using a MaskedTextBox, but when the textbox is empty it shows the empty blank lines (underscores) in the text box.
How can I avoid that and show the masked textbox like a simple empty (still masked) textbox?
Also, I want data like csc-(somenumber). Can I add some random number automatically after 'csc-' characters?
The reason the masked text box is showing a blank line is because underscore "_" is the default prompt character for a masked text box. You have two options for changing this.
If you want the prompt to be visible while the user is editing the text but hidden otherwise, set the HidePromptOnLeave property to true.
MaskedTextBox1.HidePromptOnLeave = True
If you never want to have the underscore as the prompt character, you can change the PromptChar property to be a space " ". You cannot make the PromptChar nothing, the field must have a value.
MaskedTextBox1.PromptChar = " "
For your textbox, use the MaskedTextBox class.
http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx
For getting a random number
Dim s = "csc-" & New Random().Next(1000, 10000).ToString