views:

455

answers:

1

using crystal reports 11, I'm trying to get a subtotal amount to force it to show a negative number when a database field has a value "Credit Memo".

I've tried negating the value in the totext function as you can see in the commented out line below the if trantypeilocal = "credit memo" statement, but that doesn't work. So I figured I would try to assign it to a variable and this also throws an error.

Numbervar subtot 

if PageNumber = TotalPageCount then
    (
      // ToText({tarPrintInvcHdrWrk.SalesAmt})
        if {tarPrintInvcHdrWrk.TranTypeIDLocal} = "Credit Memo" then 
         (
            subtot :=  {tarPrintInvcHdrWrk.SalesAmt}-{tarPrintInvcHdrWrk.ShipAmt}-{#FreightAndHandling};
            //ToText (-({tarPrintInvcHdrWrk.SalesAmt}-{tarPrintInvcHdrWrk.ShipAmt}-{#FreightAndHandling}) , {tarPrintInvcHdrWrk.MCDecPlaces} )
            ToText (-(subtot));
            )
        else
        ( 
        ToText ({tarPrintInvcHdrWrk.SalesAmt}-{tarPrintInvcHdrWrk.ShipAmt}-{#FreightAndHandling}, {tarPrintInvcHdrWrk.MCDecPlaces} )
        )
    )
    else
       "**********"

The error message says "The reminaing text does not appear to be part of the formula"

any ideas? thanks in advance.

A: 

i figured out a temporary fix by just concatenating

"-" + ToText ({tarPrintInvcHdrWrk.SalesAmt}-{tarPrintInvcHdrWrk.ShipAmt}-{#FreightAndHandling}) , {tarPrintInvcHdrWrk.MCDecPlaces}

in an if statement for the timebeing.

phill