Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Multiplying Array by formula Post Reply Post New Topic
Author Message
CR_Steve
Newbie
Newbie
Avatar

Joined: 13 Feb 2019
Location: United States
Online Status: Offline
Posts: 3
Quote CR_Steve Replybullet Topic: Multiplying Array by formula
    Posted: 08 Mar 2019 at 6:49am
I have the following formula
if {@1st_sort} = "LABOR" then
      [{CfgCalc.AICCost1}, {CfgCalc.AICCost2}, {CfgCalc.AICCost3}, {CfgCalc.AICCost4}, {CfgCalc.AICCost5}] [{@QtyIndex}]*{@LaborMU})

this formula is is in Group Header #3 and is summarized in GF#3. But as you can imagine it is coming in blank. Is there a way to display the @LaborMU as a number so that the CfgCalc.AICcost will multiply.

Thanks for any help
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 11 Mar 2019 at 7:17am
What does the @LaborMU formula look like? If it returns an array, what type of data is in the array? If the array contains numbers, how would you want to handle it in this situation - concatenate the numbers, sum the numbers, multiply the numbers?

-Dell
IP IP Logged
CR_Steve
Newbie
Newbie
Avatar

Joined: 13 Feb 2019
Location: United States
Online Status: Offline
Posts: 3
Quote CR_Steve Replybullet Posted: 14 Mar 2019 at 5:24am
This is Th @LaborMU formula
1+({@PrtLaborOAMkup}/100)

And this is the @PrtLaborOAMkup formula
formula = {@LaborOAMarkup}*100

And this is the @LaborOAMarkup formula
[ {OverallMarkups.LaborQ1}, {OverallMarkups.LaborQ2}, {OverallMarkups.LaborQ3}, {OverallMarkups.LaborQ4}, {OverallMarkups.LaborQ5} ] [{@QtyIndex}]


IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Mar 2019 at 9:37am
I think I know what the problem is. You can't display something in a group header that doesn't have data until after all of the group data is processed. However, there is a way around this if there will only be one value for the result at the end of the group.

Try this:

WhilePrintingRecords;
if {@1st_sort} = "LABOR" then
MAXIMUM(
    [{CfgCalc.AICCost1}, {CfgCalc.AICCost2},
     {CfgCalc.AICCost3}, {CfgCalc.AICCost4},
     {CfgCalc.AICCost5}] [{@QtyIndex}]*{@LaborMU})


-Dell
IP IP Logged
CR_Steve
Newbie
Newbie
Avatar

Joined: 13 Feb 2019
Location: United States
Online Status: Offline
Posts: 3
Quote CR_Steve Replybullet Posted: 22 Mar 2019 at 7:37am
This is the entire formula

if {@1st_sort} = "OUTSD" or {@1st_sort} = "DELVRY" then [{CfgCalc.Cost1}, {CfgCalc.Cost2}, {CfgCalc.Cost3}, {CfgCalc.Cost4}, {CfgCalc.Cost5}] [{@QtyIndex}] * 1.15
 else if {@1st_sort} = "LABOR" then

      [{CfgCalc.AICCost1}, {CfgCalc.AICCost2}, {CfgCalc.AICCost3}, {CfgCalc.AICCost4}, {CfgCalc.AICCost5}] [{@QtyIndex}]*{@LaborMU}

 else if {@1st_sort} = "MATRL"   then
    (  if {@2nd_sort} = "001" then
        [{CfgInkCalc.Cost1}, {CfgInkCalc.Cost2}, {CfgInkCalc.Cost3}, {CfgInkCalc.Cost4}, {CfgInkCalc.Cost5}] [{@QtyIndex}] * 1.1
       else if {@2nd_sort} = "000" then
        [{CfgStockCalc.Cost1}, {CfgStockCalc.Cost2}, {CfgStockCalc.Cost3}, {CfgStockCalc.Cost4}, {CfgStockCalc.Cost5}] [{@QtyIndex}] * 1.12
       else
         [{CfgCalc.Cost1}, {CfgCalc.Cost2}, {CfgCalc.Cost3}, {CfgCalc.Cost4}, {CfgCalc.Cost5}] [{@QtyIndex}] * 1.1
       )
else 0

This is in Group header #3 and it is suppressed. This is then summed in Group Footer# 3
But the red text is coming in blank.
2nd sort calculates fine. You can see that it is multiplied by a number. Whereas 1st sort need to be multiplied by a formula because the value will change. @LaborMU is a user input number
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.