Reputation: 699
I'm trying to convert from currency A to currency B in Business Central.
This is the code I'm using, which throws the error "there is no currency exchange within the specified filter":
AmountInUSD := "Currency Exchange Rate".ExchangeAmount(1, 'EUR', 'USD', Rec.SetupDate);
Checking table 330 I see some conversion rates but I don't know how to exchange...
How can I exchange from currency A to currency B? Even if none of them is the LCY (local currency)? For example convert from EUR to USD and from USD to CAD.
Upvotes: 0
Views: 636
Reputation: 16560
The function you are using should be okay for doing the conversion.
When exchanging between two foreign currencies the conversion is a two-step process:
This means that there must be valid exchange rates for both the foreign currencies in order for the process to succeed.
Based on the provided information it looks like you are at least missing an exchange rate for EUR (USD is not shown on the image).
You need to go to the Currencies page and find the Exchange Rates action for each of the currencies in question and then create a new exchange rate.
Alternatively you can set up an Exchange Rate Service to allow for automatic updates of exchange rates.
Upvotes: 0