SarahV
SarahV

Reputation: 23

Crystal Reports Formula in Text Object

I am new to formulas and struggling with something. I've got this so far:

if {tblcustomer.vat_reseller} = 0 
then VAT: {tblinvoices.vat_multiplier}*100 %
else 
if {tblcustomer.vat_reseller} = 1 
then Reverse charge: Customer to pay the VAT to HMRC

There are no errors found but it displays:

'VAT: {tblinvoices.vat_multiplier}*100 %' rather than 'VAT: 20%' or 'Reverse charge: Customer to pay the VAT to HMRC'

Sorry, it's probably an easy fix (hopefully!) but when I try and tweak the syntax it starts giving me other error such as a number is required, etc.

Upvotes: 2

Views: 910

Answers (1)

user359040
user359040

Reputation:

Values enclosed in quotes are treated as literal strings.

To get the value of {tblinvoices.vat_multiplier} multiplied by 100 inside the string, you need to convert it to a string, then concatenate it within the rest of the string - like so:

if {tblcustomer.vat_reseller} = 0 
    then "VAT: " & CStr({tblinvoices.vat_multiplier}*100) & " %"
else if {tblcustomer.vat_reseller} = 1 
    then "Reverse charge: Customer to pay the VAT to HMRC"

Upvotes: 1

Related Questions