SSRS Text box expression based on the condition

kkran 831 Reputation points
2022-04-13T16:14:17.937+00:00

Hi team - I have two text boxes in SSRS Report.
In Textbox1: there is a field1 that will be displayed. The field1 value will change depending on the multiple scenarios.

The textbox2 should be dependent on Textbox1.

If the Field1 in Textbox1 has values of either 'Income high' or 'Income low' then only the textbox2 should be displayed. If not, no need to display the textbox2.

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,949 questions
0 comments No comments
{count} votes

Accepted answer
  1. Joyzhao-MSFT 15,596 Reputation points
    2022-04-14T02:32:41.773+00:00

    Hi @kkran
    I did some tests locally.
    The expression to set the visibility of textbox 1 is as follows:

    =IIF(First(Fields!field1.Value, "DataSet1")="Income high" or First(Fields!field1.Value, "DataSet1")="Income low",True,False)  
    

    The expression to set the visibility of textbox 2 is as follows:

    =IIF(ReportItems!Textbox1.Value="Income high" or ReportItems!Textbox1.Value="Income low",False,True)  
    

    192860-image.png

    For the ReportItems collection references, please refer to: Built-in collections - ReportItems collection references in a paginated report (Report Builder).

    In order to show the variability of textbox 1, I set a parameter with three values: "Income high", "Income low", "Unknow", my purpose is when textbox 1 displays "Income high" or When "Income low", text box 1 is hidden and only text box 2 is displayed; when there is no "Income high" or "Income low" in the text box, that is, "Unknow", text box 1 is displayed and text box 2 is hidden.
    Design:
    192923-image.png
    Preview:
    192859-image.png
    192848-image.png
    192849-image.png
    Best Regards,
    Joy


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.