Conversion of an amount involving foreign currencies

63 views
Skip to first unread message

Aly IGERY

unread,
Sep 25, 2026, 7:13:15 AM (2 days ago) Sep 25
to mementodatabase
Hi guys,

We have a library called IGERYsFT with two fields:
1x [Btrg] = Amount (Format: Currency €)
1x [FWBtrg] = Foreign Currency Amount (Format: Number)

We travel abroad frequently—for example, to Turkey next week.

We would like to use a script triggered by a button to update the currency, perform the conversion, and insert the result into the target field.

We want to have two buttons:

Button: [EUR > TRY]
Button: [TRY > EUR]

For example:
1. We enter a Euro amount in the [Btrg] field: 1500
2. We click the button: [EUR > TRY]
3. The script converts it to TRY (using the ECB/TCB rate, or similar) and automatically inserts the result into the [FWBtrg] field.

And the same applies to the [TRY > EUR] button:

1. We enter a TRY amount in the [FWBtrg] field: 1000
2. We click the button: [TRY > EUR]
3. The script converts it to EUR (*1) and automatically inserts the result into the [Btrg] field.

Is this possible? If so, how can I do it? The button should only function when the entry is in edit mode.

Er Mo

unread,
Sep 25, 2026, 10:00:05 AM (2 days ago) Sep 25
to mementodatabase
Hallo
Eine einfache lösung ist das du die Bibliothek erstellst ( 2 Felder + 2 Schaltflächen ) und für Eur -> TRY das Skript einträgst
Skript
var e= entry()
var eur= e.field("Btrg")
var fwe = eur * 55.87 // Kurs
e.set("FWBtrg",fwe)

Die 55.87 ist der Aktuell Wechselkurs . Gegebenen Falls Anpassen . Für TRY -> EUR das 2 Skript
var e= entry()
var eur= e.field("FWBtrg")
var fwe = eur / 55.87 // Kurs
e.set("Btrg",fwe)

Hello
A simple solution is to create the library (2 fields + 2 buttons) and enter the script for Eur -> TRY
script
var e= entry()
var eur= e.field("Btrg")
var fwe = eur * 55.87 // rate
e.set("FWBtrg",fwe)

The 55.87 is the current exchange rate. Adjust if necessary. For TRY -> EUR the 2 script
var e= entry()
var eur= e.field("FWBtrg")
var fwe = eur / 55.87 // rate
e.set("Btrg",fwe)

Ernst

Aly IGERY

unread,
Sep 25, 2026, 10:36:03 AM (2 days ago) Sep 25
to mementodatabase
Hallo Er Mo,
danke für deine Antwort.

Ich meinte, dass das Script den Betrag über API/Server von EZB oder TCB umrechnet und ins Zielfeld einträgt. Wie Währungsumrechner-Apps.

====================================================================================================

Hello Er Mo,

thanks for your reply.

What I meant was that the script converts the amount via the API/server of the ECB or TCB (Central Bank of Turkey) and enters it into the target field—just like currency converter apps do.

Er Mo

unread,
Sep 25, 2026, 3:13:44 PM (2 days ago) Sep 25
to mementodatabase
Hallo
Habe von Frankfurter ein kostenlose API mit den Wechselkursen gefunden und eingebaut . Du muss den Skripten den zugang zum NETZ erlauben . Hir die Skript:

Hello,
I found a free API for exchange rates from Frankfurter and integrated it. You need to grant the scripts access to the network. Here are the scripts:

EUR -> TRY
var e= entry()
var eur= e.field("Btrg")
 const url = "http:/" + "/api.frankfurter.dev/v2/rate/eur/TRY"
  var result = http().get(url);
  if(result.code == "200") {
     var products = JSON.parse(result.body);
   var kurs = products.rate
}
   else if (result.code == "429") {
     message("Zuviele Abfragen ")
     cancel()
     exit()
  } else {
   message("Fehler")
    cancel()
    exit()
  }
var fwe = eur * kurs // Kurs
e.set("FWBtrg",fwe)

TRY -> EUR
var e= entry()
var eur= e.field("FWBtrg")
 const url = "http:/" + "/api.frankfurter.dev/v2/rate/try/eur"
  var result = http().get(url);
  if(result.code == "200") {
     var products = JSON.parse(result.body);
   var kurs = products.rate
}
   else if (result.code == "429") {
     message("Zuviele Abfragen ")
     cancel()
     exit()
  } else {
   message("Fehler")
    cancel()
    exit()
  }
var fwe = eur * kurs // Kurs

e.set("Btrg",fwe)

Ernst

Aly IGERY

unread,
Sep 26, 2026, 10:30:03 AM (14 hours ago) Sep 26
to mementodatabase
Hallo Ernst,

funktioniert 👍 und vielen Danks 🙏

Flaviano

unread,
Sep 26, 2026, 11:08:19 AM (14 hours ago) Sep 26
to Aly IGERY, mementodatabase
Hi Aly,

To practice calling an API using Memento, I created a sample library that implements your case using two Buttons and the free Frankfurter API (which fetches rate data from the European Central Bank) mentioned by Ernst.

You can download the attached library template file (.mlt2) and import it directly into your Memento app.

It handles both conversion directions (EUR > TRY and TRY > EUR), calculates the values, and populates the target fields automatically.

Important:
To allow fetching exchange rates from the API, make sure to grant Internet access permission to the library. Go to Automations (Scripts) > tap the Shield icon (top right) > enable the Network permission.

Safe travel!

Flaviano






--
You received this message because you are subscribed to the Google Groups "mementodatabase" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mementodataba...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mementodatabase/d34c5287-961e-4f3e-ab65-1a154105a89en%40googlegroups.com.

Currency Converter.mlt2

Aly IGERY

unread,
Sep 26, 2026, 11:43:41 AM (13 hours ago) Sep 26
to mementodatabase
Hi Flaviano,

yours works too 👍

Many thanks 🙏
Reply all
Reply to author
Forward
0 new messages