variablescrystal-reportsshared-variablecrystal-reports-2016

Crystal Report - shared numbervar


I need some help breaking down and trying to understand this formula field. I'm trying to convert Crystal Reports into Power BI Paginated and I need to reverse engineer the existing reports we have. The problem is I have nil experience in Crystal Report. Is the shared variable being assigned here or is it simply being called to the formula? The reason I'm asking is because I've looked at all the other subreports connected to this one and I cannot find the variables listed here (ValueHead, ValueMaroonHead1, ValueMaroonHead2) anywhere else in the formula fields. It only exists in THIS subreport. This is the formula for the formula field named ValueCurrent which is then used multiple times in the main report.

shared numbervar ValueHead;
shared numbervar ValueMaroonHead1;
shared numbervar ValueMaroonHead2;

if {CombinedActiveParameterValueR.ParameterID} in [22,29,78] 
and {CombinedActiveParameterValueR.ParameterDate}  > {?Pm-@Date}-7 
and {CombinedActiveParameterValueR.ParameterDate}  <= {?Pm-@Date}  
and {CombinedActiveParameterValueR.UpdateCounter} = Maximum ({CombinedActiveParameterValueR.UpdateCounter}, {CombinedActiveParameterValueR.ParameterDate}, "daily") then
ValueHead := ValueHead + {CombinedActiveParameterValueR.ParameterValue};


if {CombinedActiveParameterValueR.ParameterID} = 13  and {CombinedActiveParameterValueR.ParameterDate}  > {?Pm-@Date}-7 and {CombinedActiveParameterValueR.ParameterDate}  <= {?Pm-@Date}  and {CombinedActiveParameterValueR.UpdateCounter} = Maximum ({CombinedActiveParameterValueR.UpdateCounter}, {CombinedActiveParameterValueR.ParameterDate}, "daily") then
ValueMaroonHead1 := ValueMaroonHead1 + {CombinedActiveParameterValueR.ParameterValue};

if {CombinedActiveParameterValueR.ParameterID} = 14  and {CombinedActiveParameterValueR.ParameterDate}  > {?Pm-@Date}-7 and {CombinedActiveParameterValueR.ParameterDate}  <= {?Pm-@Date}  and {CombinedActiveParameterValueR.UpdateCounter} = Maximum ({CombinedActiveParameterValueR.UpdateCounter}, {CombinedActiveParameterValueR.ParameterDate}, "daily") then
ValueMaroonHead2 := ValueMaroonHead2 + {CombinedActiveParameterValueR.ParameterValue};


ValueHead

Say if I were to convert the first section to pseudo english, would it be:

if (calculation) then valuehead which also equals to valuehead + SQLFieldValue

Basically, I've tried googling the shared numbervar syntax to see how it is often used so I know that when a Variable is set (this could be done in subreports and then called into the main report) but I wasn't able to find the 3 variables I mentioned above anywhere else.

I've checked all the subreports (even the hidden ones) connected to this one and went through the formula fields but had no luck.


Solution

  • Did you search not only all formulas but also all expressions?

    Crystal allows you to use expressions to dynamically control many properties. Based on the shared variable names, it is likely they are used in an expression to conditionally control the color of some header sections/objects.

    Perhaps try to export the report to 'Report Definition' format and search the resulting documentation.