Location and devices

Learn how to read device location, open links, start calls, encode URLs, and scan barcodes in Ninox scripts.

Location and URL functions let your scripts work with location values and URLs.

In this chapter, you will learn how to:

  • Create location values.

  • Hand off actions to the device.

  • Encode and decode URL parts safely.

Function (A-Z)
Task

latitude()

Return the latitude from a location value

location()

Return a location value from a title and coordinates

longitude()

Return the longitude from a location value

openURL()

Open a website, map, or app link

phone()

Return a phone value with a call action

url()

Return a link value from text or query data

urlDecode()

Decode URL-encoded text

urlEncode()

Encode text for safe URL use

Work with location values

Use these functions when you want to work with a location value or pass coordinates to another service.

Work with a location value

Use location() when you want to create one location value from a title, latitude, and longitude.

Use it when you want to:

  • Store coordinates in a location field.

  • Keep a title and coordinates together in one value.

  • Pass one location value to another field or function.

location(string, number, number)

  • string: the title for the location

  • first number : the latitude

  • second number : the longitude

location() returns a location value.

Tips:

  • Use a clear title so users can recognize the saved location.

Let’s take a look at some examples:

Stores the location with the given coordinates in the address location field.

Use these functions when you want a script to hand off work to the device, browser, or another app.

Return a URL value

Use url() when you need a URL as data instead of opening it immediately.

Use it when you want to:

  • Store a link in a field or variable.

  • Reuse a generated link in a later script step.

  • Pass a URL into another function.

  • Add URL-encoded query values from a JSON object.

url(any) url(any, JSON)

  • any: the value you want to convert to a link

  • JSON: optional query values to append in URL-encoded form

url() returns a link value.

Let’s take a look at some examples:

Shows the Ninox website as a link value with an internet button.

Returns https://ninox.com?Name=Max%20Mustermann.

Tips:

  • Ninox does not validate whether the passed value is a valid URL.

  • Use the JSON argument when you want to append query values safely.

  • Use url() when you need the link as a value.

  • Use openURL() when you want to open that link right away.

Encode and decode URL parts

Use these functions when text needs to travel safely inside a URL.

Encode text

Use urlEncode() to turn text into a URL-safe form.

Use it when you want to:

  • Put user input into a query string.

  • Build safe search or API URLs.

  • Avoid broken links caused by spaces or special characters.

  • Convert plain text into URL-compliant text.

urlEncode(string)

  • string: the text you want to encode for safe URL use

urlEncode() returns a string.

Let’s take a look at some examples:

Returns hello%20world.

Returns https://ninox.com?Name=Jane%20Doe.

Tips:

  • Encode dynamic values, not the full URL structure.

  • This is especially useful for search terms and API parameters.

Decode text

Use urlDecode() to turn URL-encoded text back into normal text.

Use it when you want to:

  • Read encoded query values.

  • Show stored URL parts in plain text.

  • Reverse earlier encoding.

  • Decode URL-compliant text into readable text.

urlDecode(string)

  • string: the encoded URL text you want to decode

urlDecode() returns a string.

Let’s take a look at some examples:

Returns hello world.

Returns https://ninox.com?Name=Jane Doe.

Last updated

Was this helpful?