|
|
| |
|
|
Trainer's Talk
ADDING SEARCH FUNCTIONALITY TO YOUR CUSTOM REPORTNET APPLICATION
Applies to
Cognos ReportNet SDK - ASP.Net with VB.Net
Synopsis
So, you want to add some search functionality to your custom ReportNet Application?
Solution Fortunately, if you are already able to query the content store and list reports, then you are well on your way.
All we need to do to get started is send a text item to your page containing the text for which you would like to search.
‘We retrieve the text item:
Dim srchPath As String = Request.Form("sPath")
‘Next, we apply the Boolean Function "contains"
SrchPath = "//report[contains(@name,'" & srchPath & "')]"
‘Now, we query the content store as we would normally.
'Set the properties for the query of the content store
Dim properties(5) As propEnum
properties(0) = propEnum.defaultName
properties(1) = propEnum.defaultOutputFormat
properties(2) = propEnum.searchPath
properties(3) = propEnum.defaultDescription
properties(4) = propEnum.objectClass
properties(5) = propEnum.target
Dim sortBy(2) As sort
sortBy(1) = New sort
sortBy(1).order = orderEnum.ascending
sortBy(1).propName = propEnum.defaultName
'Query the content store
Dim results As baseClass()
Try
results = oCrn.query(srchPath, properties, sortBy, New queryOptions)
Catch er
Response.Write("#1 Err desc = " & er.Message & "<BR>")
Response.Flush()
End Try
Dim rLen As Integer
rLen = UBound(results)
Dim i as integer
For i = 0 To rLen
Dim curRes = results(i)
Response.Write curRes.defaultName.value & "<BR>"
End If
What we have done is ask for all reports that contain our search item in the name. There is full documentation in the ReportNet Developer’s guide about other properties that are searchable.
Hope this helps. Happy coding.
Questions
Have a question for our trainers?
Click here to send your questions!
|
|