lanier3532
asked on
set variables in Crystal Reports XI
I have a report with several groups:
---> Order Type
----------> Ship Date
---------------->Order Number
---------------------> Model Number
-------------------------- --Detail Row
i want to use the "Supress if repeated" option on the OrderQty at the detail level, but it also supresses the OrderQty of the previous or next order if the OrderQty is the same. I only need to supress it if the OrderNumber and Model number repeat.
i have created Global vars in a formula and placed in the Report Header:
global stringvar ProjNum;
global stringvar ModelNum;
Then in the Model Number footer:
Global stringvar ModelNum;
evaluateafter ({@detOrderQty});
ModelNum={order_details.Pr oductName}
In the Order Number footer:
global stringvar ProjNum;
evaluateafter ({@detModelNum});
ProjNum={Orders.ProjectNum ber}
and finally in the Detail Line:
Global stringvar ProjNum;
global stringvar ModelNum;
whilereadingrecords;
if ProjNum={Orders.ProjectNum ber}
and ModelNum={order_details.Pr oductName} then
0
else
{order_details.Quantity}
My assumption was that the group footers would set the global vars and if the current record didn't match the ProjNum and the ModelNum, they would return the OrderQty, else return 0.
Help is appreciated,
Harold
---> Order Type
----------> Ship Date
---------------->Order Number
---------------------> Model Number
--------------------------
i want to use the "Supress if repeated" option on the OrderQty at the detail level, but it also supresses the OrderQty of the previous or next order if the OrderQty is the same. I only need to supress it if the OrderNumber and Model number repeat.
i have created Global vars in a formula and placed in the Report Header:
global stringvar ProjNum;
global stringvar ModelNum;
Then in the Model Number footer:
Global stringvar ModelNum;
evaluateafter ({@detOrderQty});
ModelNum={order_details.Pr
In the Order Number footer:
global stringvar ProjNum;
evaluateafter ({@detModelNum});
ProjNum={Orders.ProjectNum
and finally in the Detail Line:
Global stringvar ProjNum;
global stringvar ModelNum;
whilereadingrecords;
if ProjNum={Orders.ProjectNum
and ModelNum={order_details.Pr
0
else
{order_details.Quantity}
My assumption was that the group footers would set the global vars and if the current record didn't match the ProjNum and the ModelNum, they would return the OrderQty, else return 0.
Help is appreciated,
Harold
ASKER
i put the "WhilePrintingRecords;" as the 1st line of each formula.
no success.
When i have an order with the same Model#, but different ShipTo locations, it still repeats the OrderQty even though the ProjectNumber (OrderNumber) and the ModelNumber are the same.
no success.
When i have an order with the same Model#, but different ShipTo locations, it still repeats the OrderQty even though the ProjectNumber (OrderNumber) and the ModelNumber are the same.
Can you upload the report?
mlmcc
mlmcc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, i wanted to use the "Suppress if Duplicated" option. The formulas were a terrible way to do what you elegantly accomplished using the "Previous" reference. I removed the formulas and used the "Previous" code and all is well.
Thanks again,
Harold
Thanks again,
Harold
You're welcome. Glad I could help.
FWIW, I'm not sure why your formulas didn't work. It seemed like they should. It did occur to me that the EvaluateAfter functions might be a problem. Specifically, one of your formulas used evaluateafter ({@detOrderQty}). If {@detOrderQty} was your last formula (that was checking the variables and producing {order_details.Quantity} or 0), maybe that EvaluateAfter was forcing {@detOrderQty} to be evaluated at the wrong time.
James
FWIW, I'm not sure why your formulas didn't work. It seemed like they should. It did occur to me that the EvaluateAfter functions might be a problem. Specifically, one of your formulas used evaluateafter ({@detOrderQty}). If {@detOrderQty} was your last formula (that was checking the variables and producing {order_details.Quantity} or 0), maybe that EvaluateAfter was forcing {@detOrderQty} to be evaluated at the wrong time.
James
Crystal evaluates formulas when it "can" so in this case they are being evaluated in an early pass through the report and values for variables don't get saved.
mlmcc