+44 7887 691 077 inphinity@myinphinity.comPartnersContact us
INPHINITY
  • Company
    • About Inphinity
    • Partners
    • Events
    • CSR
    • Careers
    • Inphinity Universe
    • Inphinity.App
  • News
  • Products
    • Inphinity Suite
    • Inphinity Forms
    • Inphinity Flow
    • Inphinity Mole
    • Other products
  • Solutions
    • Budgeting and Planning
    • Mole Data Privacy Analytics
    • Project Management Solution
    • Audit Genie Solution
    • ESG Reporting & Compliance
  • Resources
    • Demo apps
      • HR Workflow Into Action
      • Inphinity Files Analyzer
      • Inphinity Universe: Demo Portal
    • Webinars
      • Qlik and Inphinity: The only cloud solution for the next generation of analytics
      • Inphinity Webinar On-Demand │Qlik and Inphinity: The only cloud solution for the next generation of analytics
      • Activate your HR Analytics with Qlik and Inphinity Suite
      • Activate your data intelligence with Qlik & Inphinity Suite Superpowers for Budgeting and Planning
      • Mission Critical: 4th Gen Analytics in Healthcare
      • Qlik World 2020 Sessions
      • UHMB NHS: Taking Actions Where The Data Is
      • Waterfall AM: Actionability In Financial Services
      • Pushing the Boundaries Video Series
      • Qlik Geex: Writeback Discussion
    • Success stories
      • Waterfall AM
      • Mayo Hardware
      • UHMB NHS UK
      • Emark Analytics
      • Thunderbox Business Success
      • Inphinity Forms on Mobile
      • Inphinity Healthcare: Mission Critical
    • Technical
      • Inphinity Suite November 2022
      • TechTuesday Video Series
      • Inphinity Suite May 2022
      • Inphinity Forms Version 10.0
      • Inphinity Flow Version 2.3
      • More releases
  • Training & Consultancy
  • Menu Menu

Get The Most Out Of REST

Tips and tricks for Inphinity Forms REST functions

By Tomas Janco | | 30. November 2021

You can use Inphinity Forms REST options to set up integrations with 3rd party services. As the data format varies between different services, we added options to specify advanced data transformations as javascript functions. This is a versatile solution for data transformation, but you can do much more.

In this article, I will show you two examples of advanced REST transformation function uses.

UPDATING CURRENT ROW WITH AUTOCALCULATED VALUE BEFORE SAVING

Say we want an application where the user will manipulate current values based on previous values. I.e. user wants to increase the planned value by 10%. For this use case, we create a simple Form with four columns – the dimension, current value, relative % change, and autocalculated result value.

We create the columns as follows:

  • Current value
    • Column name: current
    • Label: Current value
    • Type: Number
  • Relative % change
    • Column name: relPercentChange
    • Label: Rel. % change
    • Type: Currency
    • Currency sign: %
    • Currency sign position: right
  • Result
    • Column name: result
    • Label: Result
    • Type: Text
    • Autocalculate: Enabled
    • Formula: =Num#('$(row.current)') * ( 1 + (Num#('$(row.relPercentChange)')/100) )

Let’s explain what the formula in the Result column does.

First, it converts the values in current and relPercentChange columns to numbers, then it divides relPercentChange by 100 (to convert from % to factor) and adds 1 (to make it relative to 100%). Lastly, it multiplies the current value by the calculated factor.

The form now looks like this:

The result column shows the current value updated by the percentual value. Upon saving the row, we want the autocalculated result to become the current value and to clear out the relative change value. We will use a trick in the REST settings.

This trick is based on three facts:

  • The REST call can be set up to happen before saving the data to Forms data storage.

  • You can manipulate the data being saved according to the result of the REST call

  • You can provide a fake REST call result without actually making any HTTP request

In the Form configuration, we enable advanced settings and in REST settings, we set up the following:

  • [X] On data save call REST endpoint (o) Before calling Forms Backend
  • URL: http://localhost/$(key)
  • [X] Request transformation
function(request) {
    request.data.current = request.data.result;
    request.data.result = "";
    request.data.relPercentChange = "";
    return {
        response: {
            status: 200,
            data: request.data
        }
    };
}

The provided URL is just a dummy URL – it will never be called. The request transformation function first copies the value in result to current, then clears result and relPercentChange and finally returns a fake response with the manipulated data. (Normally this is where the HTTP call would happen, but we do not need it so we provide the response directly).

Here is the working result:

NAVIGATING TO A DIFFERENT SHEET AFTER SAVING DATA

Not only can we manipulate the data before saving it, but we can also call other APIs and functions. Let’s say we want to proceed to the next sheet once the form is saved. We can do this by simply calling the Qlik navigation API when the save completes.

The Qlik navigation API is documented here.

To get the reference on the Qlik object, we will call require("qlik") function. Then we call navigation.nextSheet() to proceed. Finally, we return a fake response as we did in the previous example.

Here is the complete code:

function(request) {
    require("qlik").navigation.nextSheet();
    return {response: { status: 200, data: {}}};
}

If you’re interested in more functions & features of Inphinity Forms, click here.

Follow us on LinkedIn to not miss any news from the Inphinity data analytics world!

Download Trial

WRITTEN BY

  • About
  • Latest Posts
Tomas Janco
Tomas Janco
Senior Architect at Inphinity ∞
Tomas Janco
Latest posts by Tomas Janco (see all)
  • Get The Most Out Of REST - 30. November 2021

WRITTEN BY

Tomas Janco

See author's posts

Latest news

Experience the thrill of certainty at QlikWorld 2023

News & Updates | Imogen Pickett

Inphinity Suite November 2022

News & Updates | Maria Oreska

On-Demand Webinar: Take Action on Carbon Emissions with Inphinity and Cast Solutions

Event | Imogen Pickett

Most Popular

How process intelligence holds the key to excellence

Demos and Use Cases | Sean Price

How Analytics Holds a Vital Key to Health Services

News & Updates | Imogen Pickett

Inphinity Healthcare: Mission Critical Tools to Improve Patient Outcomes, Reduce Risk and Minimise Cost

Demos and Use Cases | Sean Price

Latest tweets

  • The Inphinity ∞ team are super excited to announce that we are Ruby sponsors at #qlikworld 2023. We cannot wait to… https://t.co/jddOQVTQI7yesterday
  • We are pleased to announce our partnership with @ancoreSoft. This combination of technologies will take the #Qlik u… https://t.co/KTNHRumgEc6 days ago
  • Inphinity Suite brings #qlik users unparelled additional functionality. Creating the opportunity for countless use… https://t.co/qvlp0Vc87F19 days ago
  • Check out this #ESG initiatives management application which gives decision makers greater control over ESG committ… https://t.co/K5sO0Jo65e32 days ago
  • The Inphinity ∞ team believe that #data is only meaningful when there is human interaction with it. To recognise th… https://t.co/wHTrKQ8a1x165 days ago
  • Join us at our webinar where @CastSolutionsAU will showcase a customer app for ANU combining #Qlik & #Inphinity. Th… https://t.co/h9X1bN6p07166 days ago

Subscribe and get fresh inphinity news, invitations and access to webinars
 

    Address

    Inphinity Limited
    Soho Square Centre
    18 Soho Square
    London W1D 3QL
    United Kingdom
    _

    Inphinity CEE
    Westend Gate,
    Dubravska cesta 14,
    84104 Bratislava,
    Slovakia

    +44 7887 691 077 

    inphinity@myinphinity.com

    Company

    • Contact us
    • News
    • Events
    • Partners
    • CSR
    • Careers

    Products

    • Inphinity Suite
    • Inphinity Forms
    • Inphinity Flow
    • Inphinity Mole
    • Inphinity.App
    • Other products

    Terms & Conditions | Privacy Policy | User License Agreement

    © 2019 All rights reserved by Inphinity - Enfold Theme by Kriesi
    • Twitter
    • LinkedIn
    Scroll to top

    We use cookies to give you the best possible experience on our website. By continuing to browse this site, you give consent for cookies to be used. See how.

    Got it!×

    Cookie and Privacy Settings



    How we use cookies

    We may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.

    Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.

    Essential Website Cookies

    These cookies are strictly necessary to provide you with services available through our website and to use some of its features.

    Because these cookies are strictly necessary to deliver the website, refusing them will have impact how our site functions. You always can block or delete cookies by changing your browser settings and force blocking all cookies on this website. But this will always prompt you to accept/refuse cookies when revisiting our site.

    We fully respect if you want to refuse cookies but to avoid asking you again and again kindly allow us to store a cookie for that. You are free to opt out any time or opt in for other cookies to get a better experience. If you refuse cookies we will remove all set cookies in our domain.

    We provide you with a list of stored cookies on your computer in our domain so you can check what we stored. Due to security reasons we are not able to show or modify cookies from other domains. You can check these in your browser security settings.

    Other external services

    We also use different external services like Google Webfonts, Google Maps, and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.

    Google Webfont Settings:

    Google Map Settings:

    Google reCaptcha Settings:

    Vimeo and Youtube video embeds:

    Privacy Policy

    You can read about our cookies and privacy settings in detail on our Privacy Policy Page.

    Accept settingsHide notification only