Page 1 of 1

Calculated Columns Crystal Conversion assistance

Posted: Tue Sep 29, 2009 7:15 am
by topsys
I am new to Stimulsoft reports & just geting my head around the syntax.
I am attempting to convert some of our Crystal Reports into your format but by re-creating from scratch (best way to learn I guess)

I am having a problem converting some of our logic in the formula fields in Crystal into Stimulsoft Calculated Columns.
I know that Crystals VB is a little different & have also tried re-writing with c#, however my skills are very limited with c# and I am quickly trying to learn it.

Could somebody help me convert the following crystal code into C sharp that will work in Stimulsoft please?
I have figured out the basics but the more complex if elseif else statements are just beyong me still.
This will help me a great deal to understand a more complex expressions!

if {?Tax Inclusive} = 1 then
if trim({Command.PND_BARCODE}) = 'NOTE:' OR trim({Command.PND_BARCODE}) = '*SECTION/*' OR TRIM ({Command.PND_BARCODE}) = 'SUBTOTAL' then 0
else if trim({Command.PND_SPEC}) = 'Y' then {Command.PND_RPRICE}
else (({Command.PND_RPRICE} - (({Command.PND_RPRICE} / 100) * {Command.PND_DISC})) * {Command.PND_QUANTITY})

else
if trim({Command.PND_BARCODE}) = 'NOTE:' OR trim({Command.PND_BARCODE}) = '*SECTION/*' OR TRIM ({Command.PND_BARCODE}) = 'SUBTOTAL' then 0
else if trim({Command.PND_SPEC}) = 'Y' then {Command.PND_PRICE}
else (({Command.PND_PRICE} - (({Command.PND_PRICE} / 100) * {Command.PND_DISC})) * {Command.PND_QUANTITY})


I have a simple if then else command working OK ((command.PND_BARCODE.Trim() == "*SECTION/*" ? command.PND_DESCRIPTION : command.ITE_LONGDESC)) but struggling with above.

Many thanks in advance

Calculated Columns Crystal Conversion assistance

Posted: Tue Sep 29, 2009 9:16 am
by Ivan
Hello,

Please use following expression:

Code: Select all

(TaxInclusive == 1 ?
(command.PND_BARCODE.Trim() == "NOTE:" || command.PND_BARCODE.Trim() == "*SECTION/*" || command.PND_BARCODE.Trim() == "SUBTOTAL" ? 0 :
(command.PND_SPEC.Trim() == "Y" ? Command.PND_RPRICE : ((Command.PND_RPRICE - ((Command.PND_RPRICE / 100) * Command.PND_DISC)) * Command.PND_QUANTITY))) :
(command.PND_BARCODE.Trim() == "NOTE:" || command.PND_BARCODE.Trim() == "*SECTION/*" || command.PND_BARCODE.Trim() == "SUBTOTAL" ? 0 :
(command.PND_SPEC.Trim() == "Y" ? Command.PND_PRICE : ((Command.PND_PRICE - ((Command.PND_PRICE / 100) * Command.PND_DISC)) * Command.PND_QUANTITY))))
Thank you.

Calculated Columns Crystal Conversion assistance

Posted: Tue Sep 29, 2009 9:19 am
by topsys
Fantastic
I was almost there, but this has cleared things up.

THANKS

Calculated Columns Crystal Conversion assistance

Posted: Wed Sep 30, 2009 2:36 am
by Ivan
Hello,

We are always glad to help you.
Let us know if you need any additional help.

Thank you.