I am calculating a field in report to show the Margin for various items. The result is a 4 decimal number. however, I need it to be displayed as a percentage. ex. ".1234" should be "12.34%". how can I do this? here is my code to make the first calculation. I couldnt figure out how to use the FORMAT function to do this... any ideas?
Margin10 := (XPriceTable."Unit Price" - Item."Unit Cost")/ XPriceTable."Unit Price"
0
Comments
Margin10 := ((XPriceTable."Unit Price" - Item."Unit Cost")/ XPriceTable."Unit Price") * 100
but how do I tack on a percentage sign? I tried to just add + '%' at the end but it doesnt like the fact that I'm mixing decimals and text. I also tried to create a new variable as such:
Margin10B := Margin10 + '%'
but again, it doesnt like mixing decimals and text...
any ideas?
GP := InvoicedAmt - ReturnedAmt + CostAmt;
IF (InvoicedAmt - ReturnedAmt) = 0 THEN
GPM := 0
ELSE
GPM := ((GP / (InvoicedAmt - ReturnedAmt)) * 100);
IF STRLEN(FORMAT(ROUND(GPM,2))) > MAXSTRLEN(GPMString) THEN
GPMString := FORMAT(GPM,MAXSTRLEN(GPMString))
ELSE BEGIN
GPMString := FORMAT(ROUND(GPM));
j := STRPOS(GPMString,'.');
IF j = 0 THEN
GPMString := GPMString + '.00'
ELSE IF j = STRLEN(GPMString) - 1 THEN
GPMString := GPMString + '0';
GPMString := GPMString + '%';
END;