VOLUME XCI             07/27/2021

Creating a Live Currency Converter in Ninox

By Adam Davidson, Director of Product Development

There are many instances where currencies need to be converted with the most recent and accurate conversion rates. It is time consuming to look up conversion rates manually, so in this article an automatic currency converter will be created in Ninox.

There are several choices of  APIs that provide free access to exchange rates.  For the purposes of this article, we have chosen CurrencyLayer since the API is simple to use.  It is easy to go to currencylayer.com and sign up to get a free API key if you would like to follow along.

To set up, we will need a currencies table to store all of their currency names and their corresponding three letter codes so that new currencies can be added easily from one place.  Create a table named “Currencies” with two text fields named “Name” and “Code”.

Now we will create the Table where the currencies will be converted, named “Currency Conversion”.  In this table we will create a text field named “Convert”, two links to the “Currencies” table displayed in radio button format named “From” and “To”, a button with label “GO”, and a number field to hold the result of the conversion. From here the following code was inserted into the button click function:

					do as server
	let url := "http://api.currencylayer.com/live?access_key=YOUR ACCESS KEY";
	url := url + "&currencies=" + FROM.Code + "," + TO.Code;
	let response := http("GET", url);
	let quotesStr := formatJSON(response.result.quotes);
	let fromConverter := item(split(item(split(quotesStr, "USD" + FROM.Code + """:"), 1), ","), 0);
	let toConverter := item(split(item(split(quotesStr, "USD" + TO.Code + """:"), 1), "}"), 0);
	RESULT := CONVERT * number(toConverter) / number(fromConverter)


In the code above the first three lines in the ‘do as server’ block send in the request to the API with the currencies to be converted from and to.  The next three lines work with the result to extract the two converters for the from currency and the to currency.  In the last line the conversion is calculated and the result is set to the calculated value.  


Now we have a currency converter that can convert based on live conversion rates that can be placed wherever we need it in the database.  

Office 365 Integration and Team Collaboration Coming Soon to DocumentsPLUS!

Learning Lab

Join us this Thursday at 12:00pm ET or 6:00pm CET where we’ll be working with Date fields and using the Ninox Calendar, plus a sneak peak at the newest release of Ninox CalendarPLUS

Check Out Our Templates

Did you know that Nioxus has built over 130 templates which are available to all Standard, Deluxe and Premier Nioxus members?

Nioxus University YouTube Channel

Nioxus has created nearly 100 videos and over 200 hours of content teaching you how to use and optimize Ninox, as well as our supplementary products, CalendarPLUS, ReportsPLUS and DocumentsPLUS!

Top Technology Trends, Treasures and Triumphs

Flexible Microprocessors

Microchips appear in everything from washing machines to watches. If you think they are ubiquitous now, imagine circuits that can be printed onto plastic, paper, and fabric for the price of pennies. You would even be able to attach it to produce to track the freshness of your melons! This is the brainchild of British chip designer, Arm.

The company unveiled a new prototype this last week…a plastic-based 32-bit microchip named PlasticARM. This is not the first flexible chip we have seen but it is certainly the most complex and powerful. So far it has 56,340 components that are packed in less than sixty square millimeters. This allows you to perform calculations with about 12 times more components than the very best flexible chips. It has circuits and components that print on a plastic substrate, much like a printer deposits ink onto paper.

Technology like this could allow trillions of daily necessities, such as clothing and food containers, the ability to collect, process, and transmit data over the Internet. This would be great for retailers. Of course, this is the kind of tech that goes everywhere and might cause nightmares for privacy advocates.
Most chips manufactured today are rigid devices made on silicon wafers and produced in highly specialized, very expensive factories where it takes dozens of complex chemical and mechanical processes that can take up to eight weeks from beginning to end.

James Myers at Arm says that the  processor can run a variety of programs but currently uses read-only memory so it can only run the code with which it was built. The future versions will be fully programmable and flexible. “It won’t be fast, it won’t be energy efficient, but if I’m going to put it on a lettuce to track shelf life, that’s the idea,” he says. “We’re still looking for the applications, just like the original processor guys in the 1970s. Is this about smart packaging? Is it going to be gas sensors that can tell you whether something is safe to eat or not? It could be wearable health patches, that’s a fun project we’re looking at.”

Arm, founded in 1985 as Acorn, creates and licenses designs for computer chips which are then manufactured by third parties. The company claims that 160 billion chips have been manufactured using its technology. If the internet grows like we would expect it to there could be a market for trillions of flexible computer chips.

Journal reference: Nature

Copyright 2021 © All Rights Reserved.

All logos, trademarks and names are the protected property of Nioxus Corporation or their respective owners.

“Ninox,” “Ninox Database” and the blue Ninox owl eye logo are the property of Ninox Berlin and are used with permission.