Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RDC & Conditional Formatting 1

Status
Not open for further replies.

jedownsjr

IS-IT--Management
Jun 2, 2003
121
US
I am trying to use the RDC (craxdrt.dll v8.5.0.217) to get to my text boxes' conditional formatting formulas. According to Crystal's KBase article, it looks like they enhanced the RDC after v8.0 to include FieldElements. I have tried all syntax I can think of to try to get to this. I have a bunch of text fields with conditional formatting formulas for the BackColor property. Here's the VB code snippet I am using:

These 2 lines output the text box's name & value (works fine):
MsgBox crRpt.Areas.Item(a).Sections.Item(Int(s)).ReportObjects.Item(Int(ro)).Name
MsgBox crRpt.Areas.Item(a).Sections.Item(Int(s)).ReportObjects.Item(Int(ro)).Text

These next two lines are different variations of syntax I have tried to get to the conditional formatting:
MsgBox crRpt.Areas.Item(a).Sections.Item(Int(s)).ReportObjects.Item(Int(ro)).ConditionFormula

OR

MsgBox crRpt.Areas.Item(a).Sections.Item(Int(s)).ReportObjects.Item(Int(ro)).BackColor.ConditionFormula

When I try using either of these lines, I receive an error message stating "Object Required".

I get "Object does not support this property or method" when I try this:

MsgBox crRpt.Areas.Item(a).Sections.Item(Int(s)).ReportObjects.Item(Int(ro)).FieldElements(1).BackColor.ConditionFormula


Does anyone know how to correct this to retrieve the conditional formula? Ultimately I would like to be able to set the conditional formula through code -- has anyone been able to do this?

Thank you for any help or sample code.
 
Each report object has multiple condition formulae.
You need to pick up the one you need
reportObject.ConditionFormula(x)

The value of x is also split by whether you're working with a report object or section.
The string array I use is at the bottom of this post.
These are all in the help files too.
I'm not sure how many of these were available in CR8.5, I wrote this using CR9.

strFormat(0, 0) = "crSectionAreaEnableSuppressConditionFormulaType"
strFormat(0, 1) = "crSectionAreaEnablePrintAtBottomOfPageConditionFormulaType"
strFormat(0, 2) = "crSectionAreaEnableNewPageAfterConditionFormulaType"
strFormat(0, 3) = "crSectionAreaEnableNewPageBeforeConditionFormulaType"
strFormat(0, 4) = "crSectionAreaEnableKeepTogetherConditionFormulaType"
strFormat(0, 5) = "crSectionAreaEnableSuppressIfBlankConditionFormulaType"
strFormat(0, 6) = "crSectionAreaEnableResetPageNumberAfterConditionFormulaType"
strFormat(0, 7) = "crSectionAreaEnableUnderlaySectionConditionFormulaType"
strFormat(0, 8) = "crSectionAreaStyleClassConditionFormulaType"
strFormat(0, 9) = "crSectionAreaBackgroundColorConditionFormulaType"
strFormat(0, 10) = "crSectionAreaShowAreaConditionFormulaType"
strFormat(0, 11) = "crSectionAreaEnableHideForDrillDownConditionFormulaType"
strFormat(0, 20) = "crOutputFormatConditionFormulaType"
strFormat(0, 40) = "crLeftLineStyleConditionFormulaType"
strFormat(0, 41) = "crRightLineStyleConditionFormulaType"
strFormat(0, 42) = "crTopLineStyleConditionFormulaType"
strFormat(0, 43) = "crBottomLineStyleConditionFormulaType"
strFormat(0, 44) = "crHasDropShadowConditionFormulaType"
strFormat(0, 45) = "crBackgroundColorConditionFormulaType"
strFormat(0, 46) = "crBorderColorConditionFormulaType"
strFormat(0, 47) = "crTightHorizontalConditionFormulaType"
strFormat(0, 48) = "crTightVerticalConditionFormulaType"
strFormat(0, 60) = "crEnableSuppressConditionFormulaType"
strFormat(0, 61) = "crEnableKeepTogetherConditionFormulaType"
strFormat(0, 62) = "crEnableCloseAtPageBreakConditionFormulaType"
strFormat(0, 63) = "crHorizontalAlignmentConditionFormulaType"
strFormat(0, 64) = "crEnableCanGrowConditionFormulaType"
strFormat(0, 65) = "crToolTipTextConditionFormulaType"
strFormat(0, 66) = "crStyleClassConditionFormulaType"
strFormat(0, 67) = "crRotationConditionFormulaType"
strFormat(0, 68) = "crHyperLinkConditionFormulaType"
strFormat(0, 80) = "crSuppressIfDuplicatedConditionFormulaType"
strFormat(0, 81) = "crUseSystemDefaultConditionFormulaType"
strFormat(0, 100) = "crNDecimalPlacesConditionFormulaType"
strFormat(0, 101) = "crRoundingFormatConditionFormulaType"
strFormat(0, 102) = "crEnableUseLeadZeroConditionFormulaType"
strFormat(0, 103) = "crNegativeFormatConditionFormulaType"
strFormat(0, 104) = "crCurrencySymbolFormatConditionFormulaType"
strFormat(0, 105) = "crEnableSuppressIfZeroConditionFormulaType"
strFormat(0, 106) = "crThousandsSeparatorConditionFormulaType"
strFormat(0, 107) = "crThousandSymbolConditionFormulaType"
strFormat(0, 108) = "crDecimalSymbolConditionFormulaType"
strFormat(0, 109) = "crCurrencySymbolConditionFormulaType"
strFormat(0, 110) = "crHasOneSymbolPerPageConditionFormulaType"
strFormat(0, 111) = "crCurrencyPositionConditionFormulaType"
strFormat(0, 112) = "crDisplayReverseSignConditionFormulaType"
strFormat(0, 113) = "crZeroValueStringConditionFormulaType"
strFormat(0, 114) = "crAllowFieldClippingConditionFormulaType"
strFormat(0, 120) = "crYearFormatConditionFormulaType"
strFormat(0, 121) = "crMonthFormatConditionFormulaType"
strFormat(0, 122) = "crDayFormatConditionFormulaType"
strFormat(0, 123) = "crWindowsDefaultTypeConditionFormulaType"
strFormat(0, 124) = "crDateOrderConditionFormulaType"
strFormat(0, 125) = "crDayOfWeekTypeConditionFormulaType"
strFormat(0, 126) = "crDayOfWeekSeparatorConditionFormulaType"
strFormat(0, 127) = "crDayOfWeekPositionConditionFormulaType"
strFormat(0, 128) = "crDateFirstSeparatorConditionFormulaType"
strFormat(0, 129) = "crDateSecondSeparatorConditionFormulaType"
strFormat(0, 130) = "crEraTypeConditionFormulaType"
strFormat(0, 131) = "crCalendarTypeConditionFormulaType"
strFormat(0, 132) = "crDatePrefixSeparatorConditionFormulaType"
strFormat(0, 133) = "crDateSuffixSeparatorConditionFormulaType"
strFormat(0, 134) = "crDayOfWeekEnclosureConditionFormulaType"
strFormat(0, 140) = "crDateTimeOrderConditionFormulaType"
strFormat(0, 141) = "crDateTimeSeparatorConditionFormulaType"
strFormat(0, 160) = "crTimeBaseConditionFormulaType"
strFormat(0, 161) = "crAMPMFormatConditionFormulaType"
strFormat(0, 162) = "crHourFormatConditionFormulaType"
strFormat(0, 163) = "crMinuteFormatConditionFormulaType"
strFormat(0, 164) = "crSecondFormatConditionFormulaType"
strFormat(0, 165) = "crPMStringConditionFormulaType"
strFormat(0, 166) = "crAMStringConditionFormulaType"
strFormat(0, 167) = "crMinuteSecondSeparatorConditionFormulaType"
strFormat(0, 168) = "crHourMinuteSeparatorConditionFormulaType"
strFormat(0, 180) = "crColorConditionFormulaType"
strFormat(0, 181) = "crFontConditionFormulaType"
strFormat(0, 182) = "crFontStyleConditionFormulaType"
strFormat(0, 183) = "crFontSizeConditionFormulaType"
strFormat(0, 184) = "crFontStrikeOutConditionFormulaType"
strFormat(0, 185) = "crFontUnderLineConditionFormulaType"
strFormat(0, 200) = "crTextInterpretationConditionFormulaType"
strFormat(0, 220) = "crCaptionConditionFormulaType"
strFormat(0, 221) = "crDrillDownTabTextConditionFormulaType"
strFormat(1, 0) = "SectionAreaEnableSuppress"
strFormat(1, 1) = "SectionAreaEnablePrintAtBottomOfPage"
strFormat(1, 2) = "SectionAreaEnableNewPageAfter"
strFormat(1, 3) = "SectionAreaEnableNewPageBefore"
strFormat(1, 4) = "SectionAreaEnableKeepTogether"
strFormat(1, 5) = "SectionAreaEnableSuppressIfBlank"
strFormat(1, 6) = "SectionAreaEnableResetPageNumberAfter"
strFormat(1, 7) = "SectionAreaEnableUnderlaySection"
strFormat(1, 8) = "SectionAreaStyleClass"
strFormat(1, 9) = "SectionAreaBackgroundColor"
strFormat(1, 10) = "SectionAreaShowArea"
strFormat(1, 11) = "SectionAreaEnableHideForDrillDown"
strFormat(1, 20) = "OutputFormat"
strFormat(1, 40) = "LeftLineStyle"
strFormat(1, 41) = "RightLineStyle"
strFormat(1, 42) = "TopLineStyle"
strFormat(1, 43) = "BottomLineStyle"
strFormat(1, 44) = "HasDropShadow"
strFormat(1, 45) = "BackgroundColor"
strFormat(1, 46) = "BorderColor"
strFormat(1, 47) = "TightHorizontal"
strFormat(1, 48) = "TightVertical"
strFormat(1, 60) = "EnableSuppress"
strFormat(1, 61) = "EnableKeepTogether"
strFormat(1, 62) = "EnableCloseAtPageBreak"
strFormat(1, 63) = "HorizontalAlignment"
strFormat(1, 64) = "EnableCanGrow"
strFormat(1, 65) = "ToolTipText"
strFormat(1, 66) = "StyleClass"
strFormat(1, 67) = "Rotation"
strFormat(1, 68) = "HyperLink"
strFormat(1, 80) = "SuppressIfDuplicated"
strFormat(1, 81) = "UseSystemDefault"
strFormat(1, 100) = "NDecimalPlaces"
strFormat(1, 101) = "RoundingFormat"
strFormat(1, 102) = "EnableUseLeadZero"
strFormat(1, 103) = "NegativeFormat"
strFormat(1, 104) = "CurrencySymbolFormat"
strFormat(1, 105) = "EnableSuppressIfZero"
strFormat(1, 106) = "ThousandsSeparator"
strFormat(1, 107) = "ThousandSymbol"
strFormat(1, 108) = "DecimalSymbol"
strFormat(1, 109) = "CurrencySymbol"
strFormat(1, 110) = "HasOneSymbolPerPage"
strFormat(1, 111) = "CurrencyPosition"
strFormat(1, 112) = "DisplayReverseSign"
strFormat(1, 113) = "ZeroValueString"
strFormat(1, 114) = "AllowFieldClipping"
strFormat(1, 120) = "YearFormat"
strFormat(1, 121) = "MonthFormat"
strFormat(1, 122) = "DayFormat"
strFormat(1, 123) = "WindowsDefaultType"
strFormat(1, 124) = "DateOrder"
strFormat(1, 125) = "DayOfWeekType"
strFormat(1, 126) = "DayOfWeekSeparator"
strFormat(1, 127) = "DayOfWeekPosition"
strFormat(1, 128) = "DateFirstSeparator"
strFormat(1, 129) = "DateSecondSeparator"
strFormat(1, 130) = "EraType"
strFormat(1, 131) = "CalendarType"
strFormat(1, 132) = "DatePrefixSeparator"
strFormat(1, 133) = "DateSuffixSeparator"
strFormat(1, 134) = "DayOfWeekEnclosure"
strFormat(1, 140) = "DateTimeOrder"
strFormat(1, 141) = "DateTimeSeparator"
strFormat(1, 160) = "TimeBase"
strFormat(1, 161) = "AMPMFormat"
strFormat(1, 162) = "HourFormat"
strFormat(1, 163) = "MinuteFormat"
strFormat(1, 164) = "SecondFormat"
strFormat(1, 165) = "PMString"
strFormat(1, 166) = "AMString"
strFormat(1, 167) = "MinuteSecondSeparator"
strFormat(1, 168) = "HourMinuteSeparator"
strFormat(1, 180) = "Color"
strFormat(1, 181) = "Font"
strFormat(1, 182) = "FontStyle"
strFormat(1, 183) = "FontSize"
strFormat(1, 184) = "FontStrikeOut"
strFormat(1, 185) = "FontUnderLine"
strFormat(1, 200) = "TextInterpretation"
strFormat(1, 220) = "Caption"
strFormat(1, 221) = "DrillDownTabText"

Andrew Baines
Chase International
 
Thanks for that, Andrew (*). I can't find any mention of those names in the Help files. Where are they?

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top