Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

vb.net - SSRS 2008: Check array is empty in custom code

Not totally new to SSRS but completely new to custom code. I have a function that I need to use to check if all parameters are null or blank. I was able to figure out how to do this with two of the fields but I am not sure how to handle doing this with the rest of the parameters as they are I believe arrays since the allow multiple values. Any guidance on this would be greatly appreciated. Any resources such as books or sites that could help me in the future would also be a big plus as almost all the search results I get are for everything BUT handling things in custom code.

Function NoParameters(StartDate as DateTime, EndDate as DateTime) As Boolean
Dim RetValue as Boolean
RetValue = "False"
If(StartDate = Nothing And EndDate = Nothing)
RetValue = "True"
Else
RetValue = "False"
End If
Return RetValue
End Function

To clarify all parameters are set to allow null or blank. Doing this so that the user has to select at least ONE parameter but can also select any and all parameters. Handling the parameters on the SQL side with a dynamic query.

question from:https://stackoverflow.com/questions/65848721/ssrs-2008-check-array-is-empty-in-custom-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You could just pass the count of the parameter to your function and check if it's zero I guess.

pass in Parameters!myParameter.Count

If I have misunderstood let me know and show how you currently call the custom code.

Having said all that if the parameters are required, you should not be able to run the report anyway?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...