简体   繁体   中英

Comments in SSRS Report Expressions

I'm using some complicated expressions in Reporting Services to control the value, format etc of data in a report (see MSDN ).

Is it possible to insert code comments into these expressions, and if so, what is the syntax?

By code comments I mean something like:

// single line comment
/* or multi line comment */

It looks like VB Code.
Try using apostrophe to write a comment.

'This is a sample comment.

This is a guess :)

EDIT: VB doesn't really have multiline comment.
However, try using the following to see if it works


'This is a sample comment _
followed by a new line _
and the comment ends

If that doesn't work, you could do


'This is a sample comment
'followed by a new line
'and the comment ends

EDIT2: Also, it seems that comment should be in the end.

If you would like to comment a switch statement you could do something like this:

=switch(
   false, "--- First, test if above zero ---"
   , Parameters!Test.Value > 0
   , "Value is above zero. Yeah!"

   , false, "--- Then test if -1 ---"
   , Parameters!Test.Value = -1
   , "I guess the value is unknown"

   , false, "--- Finally catch everything else ---"
   , true
   , "We could not handle this value. Sorry :-\"
)

The lines with false will never be hit and that way you could use them as a comment. Not very beautiful but quite useful :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM