Jump to content
  • 0

I want to display or hide text in HTML Block on report results page



This is a tabular reports datapage.

I would like to display or hide the text in an HTML Block on the results page if the value of a field in the searched table is equal to a field in the  authentication table.

I want "Request Transfer" to be hidden if the value of the Parent_Company field in the searched table is the same as the Parent_Company field in the authentication table.



Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hello @MrApps,

As far as I understood, the text in the HTML block should be hidden depending on the value displayed in the 'Partner_Company' field (the 2nd field on your screenshot).

I suggest the following solution:

1) Add a Calculated Field on the Results page. The formula should compare the 'Partner_Company' value with the value in the table used for the Authentication. 

If the values are equal the empty string is returned, if they are not equal, the link is displayed.

CASE WHEN [@field:Parent_Company] = '[@authfield:Parent_Company]'
ELSE '<a href="https://some_link">Request Transfer</a>'

 When you click the 'Insert' button you can select the field from the data source and the the field from the Authentication.


2) In the HTML block add the Calculated field as an HTML



Here is the result (I logged in as a user with Parent_company = Company_3):


3) Then to hide the Calculated Field, please add the styles in the DataPage Header. Disable the HTML editor on the Advanced tab before pasting the code.

form[action*='[@cbAppKey]'] tr.cbResultSetTableHeader th:nth-child(3),
form[action*='[@cbAppKey]'] tr.cbResultSetDataRow td:nth-child(3) {
display: none;

I used '3' because in my example the Calculated field is the 3rd field on the Result page. Replace the digits if needed. 

P.S. If you pass a parameter via URL (when the user clicks the 'Request Transfer' link) and need assistance with adding it to the URL, please let me know.

Link to comment
Share on other sites

  • 0

@MrApps,  you are welcome.

As for the styles, actually, you can skip this part to hide the field and its label:

 tr.cbResultSetTableHeader th:nth-child(3),
 tr.cbResultSetDataRow td:nth-child(3) {
         display: none;

The AppKey is a unique identifier of the DataPage. This part in the DataPage deploy code is the DataPage AppKey:


For example, if you deploy 2 Reports on one webpage, the styles without this part 'form[action*='[@cbAppKey]']' will be applied to both Reports. In this example, the third field will be hidden on both Reports.

So, to apply the styles to the specific DataPage we can use the AppKey parameter. It is replaced with the real DataPage AppKey when the DataPage is loaded. 

To summarize, this is an approach to prevent a mess with styles. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...