Adding a new line in Report Builder expressions

I typically use Report Designer, but I have a new project requiring Report Builder 3.0.  In Report Designer (BIDS), I can take more complex expressions (ie SWITCH with 5 or 6 options), and put each pairing on a new line to be able to better read the code.

In the Expression Editor in Report Builder, pressing the ENTER key on my keyboard closes the Expression dialog box and saves the changes.

Is there any way to add line returns in the code to make it more readable?  The expression editor wraps when it runs out of room, but this doesn't make it more readable, in some cases, it wraps in the middle of a field name, making it even less readable.

The 2012 version also has this same "feature&

March 14th, 2014 1:05am

Hi Ann,

Based on your description, you want to add a line break in Report Builder expression, so that the code to can be more readable. In Reporting Services, when we edit expression in expression builder, the builder will be opened with a fixed size. But the code in the expression will extend to the right until the end. So the code is not easy to read. 

Based on my further research, we can manually press Enter key to wrap the code into several rows in the expression dialog box. And we can also manually expand the builder to a large size to make the code more readable. Besides, if there are some long duplicate data in the code, we can use custom code to simplify the expression.

If there are any misunderstanding, please elaborate the issue for further investigation.

Thanks,
Katherine Xiong

If you have any feedback on our support, please click here.

Free Windows Admin Tool Kit Click here and download it now
March 14th, 2014 2:04pm

Thank you so much for taking the time to respond.

In Report Builder, when I press the "Enter" key, it closes the Expression dialog box instead of adding a line. In BIDS and SSDT, the "Enter" key works.

I did find the answer though last night on MS Connect in a Feature Request. CTRL+Enter will add a line return in the Report Builder expression dialog box.

March 14th, 2014 2:19pm

Hi Ann,

Sorry for misunderstanding your question. Glad to heard that the issue had been solved and thanks for your sharing. It will be very beneficial for other community members who have similar questions.

Id like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings or concerns you may have.

Regards,
Katherine Xiong

If you have any feedback on our support, please click here.

Free Windows Admin Tool Kit Click here and download it now
March 17th, 2014 2:24am

I use "vbCrLf" in my expressions. 

e.g. =Replace(Fields!ErrorDoc.Value,"><",">"+vbCrLf+"<")

September 4th, 2015 4:25pm

Thanks for chiming in Halomez.   I was looking for a solution to make the code easier to read in the expressions builder.  It is simply Enter in Report Designer, but CTRL + Enter in Report Builder.

I have also used the vbCrLf that you mention for adding hard returns to the results of an expression, unfortunately, it does not help with making the actual expression more readable when working on the code itself.  

I'll have to play with trying to intercept the error codes and adding hard returns, since I hate scrolling forever to read error messages as well. Thanks.

Free Windows Admin Tool Kit Click here and download it now
September 4th, 2015 5:30pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics