Type conversion: Code + Decimal

tro#1tro#1 Member Posts: 122
Embarassing... I can`t figure out the solution myself. I also searched the forum and found similar postings but none of them could help me either.

I get following error message:
"Type conversion is not possible because 1 of the operators contains an invalid type.
Code + Decimal"

What I try to do:
Report: Sales Invoice

New Variable: CurrCode
I fill this variable with the corresponding currency code symbol.

I want to show the amount as
CurrCode + Amount

SourceExpr: CurrCode+"Sales Invoice Line"."Amount Including VAT"
and then I get the error message which I understand.

I tried different DataTypes for CurrCode
I also tried FORMAT and EVALUATE but I can`t make it work...

Answers

  • MalajloMalajlo Member Posts: 294
    SourceExpr: CurrCode + ' ' + FORMAT("Sales Invoice Line"."Amount Including VAT")
    
  • tro#1tro#1 Member Posts: 122
    Thank you Malajlo,

    the problem with your solution is, that it does not print two decimal places any more. It just prints the actual decimal places - and if there aren`t any then none get printed:

    e. g.
    € 63
    or
    € 63,1
    or
    € 63,11

    But it should always print two decimal places.
  • MalajloMalajlo Member Posts: 294
    Complicated... Once I did it cleaner, but forgot where ;)
    format(round("Sales Invoice Line"."Amount Including VAT",1))+','+format(("Sales Invoice Line"."Amount Including VAT"-round("Sales Invoice Line"."Amount Including VAT",1,'<'))*100)
    
  • MBergerMBerger Member Posts: 413
    Malajlo wrote:
    Complicated... Once I did it cleaner, but forgot where ;)
    format(round("Sales Invoice Line"."Amount Including VAT",1))+','+format(("Sales Invoice Line"."Amount Including VAT"-round("Sales Invoice Line"."Amount Including VAT",1,'<'))*100)
    
    format(value,0,'<precision,2:2><standard format,0>') ;
    
  • tro#1tro#1 Member Posts: 122
    Thank you MBerger.
    This is a very elegant solution and it works fine!
  • MalajloMalajlo Member Posts: 294
    You can also use AutoFormatExpr property (set to i.e. "Sales Header"."Currency Code")
Sign In or Register to comment.