I've been digging in the the RAS API and I see how to do the obvious stuff with formatting objects (set the font, Top, Left properties, etc.). But now I'm stuck on the hard stuff. I'm trying to get access to the conditional formulas associated with various report objects.
For example, there is a database field and the Suppress property has a conditional formula associated with it. How do I get to that? I see an Attributes collection, and I thought that it might be in there. But when I reference it via the DataDefCollection it's empty. I tried to reference it via the ReportDefCollection (this is where I feel it should actually be), but I get errors when I perform the casting from GetAllReportObjects() to ISCRField.
I also see a ConditionalFormulas collection and ConditionalFormula class, but beyond seeing them in the API reference, I can't see how they are associated with a report object at all. No property on any object that I've seen so far references the ConditionalFormulas collection. There has to be a property that links an object to it's conditional formulas collection, otherwise why would they expose a ConditionalFormulas collection/class in the first place? Ugh.
Any ideas or sample code on how I can dig into this part of the report object model?
Update:
I found that there is a ConditionFormulas collection here: ISCRReportObject.Format.ConditionFormulas. However, it doesn't expose every property and I found that the DisplayString property always returns null (just the one I needed too!). Here is the code for anyone that needs this in the future.
Note 1: in the last line you have to use an enumerator to specify which conditional formatting property you want to access.
Note 2: I had to break the line after ConditionFormulas so that it would fit on the page. Merge them back.
ReportObjects myReportObjects; myReportObjects = rcd.ReportDefController.ReportObjectController.GetAllReportObjects(); ISCRReportObject myObj; myObj = (ISCRReportObject)myReportObjects[0]; //use whichever object you want string myFormula; myFormula = myObj.Format.ConditionFormulas [CrObjectFormatConditionFormulaTypeEnum.crObjectFormatConditionFormulaTypeDisplayString].Text;
Thanks.
Edited by: Brian Bischof on Jun 27, 2008 9:31 AM