Highlight a value in a string in SSRS BAQ Report

Good morning,
I have a BAQ Report with a list of operations in a string. I used String_Agg in my BAQ to pull these into a single field. For example, this list of operations:

9,WJ,9,9,MP,2B,MCU,8BB,9,GC,9,4A,4A,8BB,10MB,MP,9,SP,9,10MB,MP,9,PSF,9,10MB,9.

These codes represent the resource groups for each operation. In my PDF output of this report I would like to highlight the current operation somehow. Either by coloring the background of just those characters, or by underlining, bolding, or adding a box around it. I was thinking I could set the font property with an expression in the RDL. I am just not sure exactly how to write that expression.

I know which is the current operation. Op 50, or GC in this case. I have this already in my report in a separate field as the op sequence. I have to use this op sequence to move through the string of resource groups and highlight the current resource group for the current operation. I thought about just searching for the first instance of the resource group related to the op sequence. However, if the current op is “MP”, for example, I wouldn’t know which MP to highlight in the string, as that resource group is used on more than one operation.

Is this even possible in the SSRS RDL?

1 Like

image
image

Right click on the field in your rdl and go to placeholder properties.
Then you might be able to figure out how to do it with html.

2 Likes

That worked like a charm! I used this in my calculated field that spits out the list of operations:

String_Agg(iif(JobOpDtl.ResourceGrpID='',right(JobOpDtl.CapabilityID,len(JobOpDtl.CapabilityID)-1), iif(JobOper2.OprSeq=NextOp1.Calculated_NextOp, '<b>' + JobOpDtl.ResourceGrpID + '</b>', JobOpDtl.ResourceGrpID)) ,',')

Thank you!

2 Likes

I’m trying to do something similar to where it highlights or bolds only specific texts within a text field. I don’t want the entire comment’s text field bolded, only certain text within that comment text field to be bolded. Does your solution resolve this issue also?

For example, in Quote Entry, in the header comments, we are pulling it into the SSRS report but want to bold specific text within the header comments such as “Attention: Please see details below” and only these text comments should be bolded, all other text within that field to be normal font.

I think it should! You can use HTML in your report, and in your expressions.
Good luck!

Where is your conditional statement to highlight only certain specific text? I don’t see it your calculated field how it is doing this.

I do this expression in the BAQ using the iif statement. My op list is generated one op at a time and mushed together with string_agg. In your case, you have to parse through the comment text to identify a piece of text that you want to change the formatting for. Basically, you need to create a calculated field that regenerates the output of your comment text, with HTML tag embedded.
I asked Bing AI to write you an expression and I think this is pretty close:

CASE 
    WHEN CHARINDEX('Your Phrase', QuoteHed.QuoteComment) > 0 THEN 
        SUBSTRING(QuoteHed.QuoteComment, 1, CHARINDEX('Your Phrase', QuoteHed.QuoteComment) - 1) + 
        '<b>' + 'Your Phrase' + '</b>' + 
        SUBSTRING(QuoteHed.QuoteComment, CHARINDEX('Your Phrase', QuoteHed.QuoteComment) + LEN('Your Phrase'), LEN(QuoteHed.QuoteComment))
    ELSE 
        QuoteHed.QuoteComment
END

In this example, replace ‘Your Phrase’ with whatever phrase you want to be in bold (or whatever HTML style you want).

:smiley: I’ll see if this works directly in a report text field using the HTML tag.

Directly in a calculated BAQ field, not in your report RDL.

The report is not a SSRS BAQ Report, it is using the standard QuotForm RDD.