Skip to Content

 from ReportObject crRptObj in rptDoc.ReportDefinition.ReportObjects

 

This declares the variable crRptObj as type ReportObject, then it says to search or iterate through the collection rptDoc.ReportDefinition.ReportObjects assigning it to the crRptObj variable.

 

where crRptObj.Kind == ReportObjectKind.SubreportObject

 

This is the comparison statement, it allows you to select the conditions to look for.

Like an SQL query you can set multiple conditions through the use of AND, OR, NOT statements.

 

 select (SubreportObject)crRptObj;

 

If the WHERE statement condition is met, then this line adds a variable to the result set. This could be the current item in the collection, or a completely different object. In this case we are type-casting the current object into a SubreportObject and returning that. 

The result has to match  the type that we defined QueryResults in the first item.

 

 I hope this was useful or at least a little interesting and that you will try to incorporate LINQ into your code!

Here are some websites on LINQ:

http://msdn.microsoft.com/en-us/netframework/aa904594.aspx
http://en.wikipedia.org/wiki/Language_Integrated_Query

And the LINQ to my Crystal Add-In sample, though it has not been updated yet with the LINQ code:
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/208428c9-eebd-2b10-0c83-8c7579e8e82a

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply