on 07-26-2010 3:14 PM
Hello,
in my enterprise we've got a tools wich can scan all our reports (rpt files in a directories) in order to find database objects (table, view, procedure, etc.) or string.
This tools is very usefull to know the consequences of a development or a database modification.
In the rpt files we programmatically scan objects, formulas, parameters, request and selection formula
Recently we've noticed thant this tool don't consider conditionnal formula, especially the formulas used to define if a section is visible or not. (I think it's the same for visibility conditionnal formulas of report objects)
In order to correct this omission, I look into report document object model, but I can't find anything (none into formulafields none into reportdefinition.areas sections)
Is it possible (I hope so)
How ?
Thank you
Yoann
You will have to use the InProc Report Application Server SDK (ObjectFormatConditionFormula class and it's sub-classes). Remember that the RAS SDK only installs with full versions of Crystal Reports (e.g.; the versions that bundle with .NET do not install the RAS SDK).
I do not have any samples of this, but I can point you at the part of the help file if you let me know what version of CR you are using.
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok. Good. A few more resources re. RAS for you then. These should make the job a bit easer:
[How to Use The RAS SDK .NET With In-Process RAS Server|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10b840c0-623f-2b10-03b5-9d1913866b32]
[Programming tutorial|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b050afe0-2fa5-2b10-658d-98f214ba6a4a]
[Samples|https://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples]
[More samples|http://www.sdn.sap.com/irj/boc/samples?rid=/webcontent/uuid/80774579-b086-2b10-db91-ed58c4dda375] [original link is broken];
[Dev library|https://boc.sdn.sap.com/developer/library]
Ludek
Here is the code I've made in order to find all conditionnal formulas (all formula type on all section and objects) :
Private Sub searchInFormuleConditionnelle(ByVal objName As String, ByVal p_report As ReportDocument)
Dim rasDoc As ClientDoc.ISCDReportClientDocument = p_report.ReportClientDocument
' search for conditionnal formulas on report area/section
For Each aire As ReportDefModel.Area In rasDoc.ReportDefinition.Areas
For Each section As ReportDefModel.Section In aire.Sections
Dim listFormules As ReportDefModel.SectionAreaFormatConditionFormulas
listFormules = section.Format.ConditionFormulas
' can we do this more efficient / beautiful ?
For Each formuleType As Integer In [Enum].GetValues(GetType(ReportDefModel.CrSectionAreaFormatConditionFormulaTypeEnum))
Dim formule As ReportDefModel.ConditionFormula = listFormules(formuleType)
If formule IsNot Nothing AndAlso formule.Text <> String.Empty Then
' for the moment we just print the formula
Debug.WriteLine(formule.Text)
End If
Next
Next
Next
' search for conditionnal formulas on report object
For Each obj As ReportDefModel.ReportObject In rasDoc.ReportDefController.ReportObjectController.GetAllReportObjects
Dim listFormules As ReportDefModel.ObjectFormatConditionFormulas
listFormules = obj.Format.ConditionFormulas
For Each formuleType As Integer In [Enum].GetValues(GetType(ReportDefModel.CrObjectFormatConditionFormulaTypeEnum))
Dim formule As ReportDefModel.ConditionFormula = listFormules(formuleType)
If formule IsNot Nothing AndAlso formule.Text <> String.Empty Then
Debug.WriteLine(formule.Text)
End If
Next
Next
End Sub
These function is called for all report and subreport of my rpt file, but it seems that ReportClientDocument is not available for sub-report.
Is there a trick ? an another object ?
Second question many of the objects, method used here are not available in SDK documentation and VB .net autocompletion (we can only see them in debugger), is it normal ?
Thanks
Yoann
Off the ReportClientDocument you should be able to use the SubReportController to get a SubReportClientDocument which has most of the same properties as the ReportClientDocument.
As for the documentation, there is no specific documentation available for the inProc RAS SDK you are using, you would want to look at the Report Application Server (RAS) SDK documentation which covers most of the properties you are using.
Re-open because I have some trouble
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.