I have two custom columns, margin and margin% in my report
Margin=(unitprice-unit cost+inv.discount Amount+special price)
margin column is working fine but margin% columns is not getting the correct result, it is showing all zeros…
i have used below c/al code :
IF (“Sales Line”.“Unit Price” <> 0) THEN
GM := (“Gross Margin” /(“Sales Line”.“Unit Price”) *100
GM := 0;
I have defined variables,Gross margin and GM% in c/al globals.i have tested abv c/al code
Only division operation is not working in the code, but i had tested with other operators like +, - …its getting result. Please can any one help me on this. Eagerly waiting for your valuable solutions…
Thanks in Advance
Where did you write the above code and what is not working?
do you have values in Sales Line.Unit Price?
S,there are values for Sales Line.UnitPrice and there are some zeros too…i have written code under…
Sales Line -onafterGetRecord.
Perhaps if you could just copy all of the code in your OnAfterGetRecord trigger and paste it into a post here, we might get a better understanding of the flow of your code and any conditions that might lead to the problem you’re describing? By simply looking at the first message you’ve posted, we can’t make any real evaluations of how you’ve named variables, whether you’re using them consistently, etc.
Also, be sure to check the textbox control that you’ve defined for the Gross Margin %, looking carefully at the properties SourceExpr and DecimalPlaces, and post those values here as well. Lastly, take a look at the global variable definition for your Gross Margin % variable to ensure that the data type is decimal and not integer. I’m guessing it’s decimal, but it doesn’t hurt to check. And, if you’re running this report in RTC and you’re using this global variable as the source expression for your output control, also be sure that the IncludeInDataset property for the variable is set to Yes.