2 Replies Latest reply: Jan 24, 2018 2:04 AM by Aiham Azmeh RSS

    How to use App Integration API when fields have spaces

    Buddy Bains

      I'm using QlikSense 3.2 and trying to implement app chaining by building dynamic URLs using the App Integration API. My goal is to be able to pass current selection criteria from a "master" app to a "detail" app. I'm using the Sense Navigation + Actions extension and the Emulating document chaining in Qlik Sense paper to model my solution.

       

      I have this solution working except for when the Field whose selections I'm trying to pass has spaces in its name (e.g. Field 1 vs Field1). I build the URL in a sheet expression.

       

      This URL works:

      https://<ServerName>/sense/app/<AppID>/sheet/<SheetID>/state/analysis/select/Field1/Value1;Value 2;Value3/

       

      but this one does not:

      https://<ServerName>/sense/app/<AppID>/sheet/<SheetID>/state/analysis/select/[Field 1]/Value1;Value 2;Value3/


      I tried removing the square brackets ("[ ]") from the not-working URL, but then my sheet expression would not return a value.


      My field's selected values (Value1, Value 2, and Value3) are all text values, not numbers presented as text.  For example, they're global regions like China, Japan, Mid East - Africa, etc.


      Any ideas on how to make this work when the field name has spaces in it?

        • Re: How to use App Integration API when fields have spaces
          Buddy Bains

          I was able to solve this myself. To build my selected values segments I was using variable with this expression for each filter field

           

          vFieldSelections

          If(GetSelectedCount($1)=0,Null(),'select/' & '$1/' & Concat(distinct $1,';') & '/')

           

          When a field had spaces in its name, I had to enclose it in brackets when passing it into the variable or else the variable would not resolve:

           

          $(vFieldSelections([Field 1])

           

          But in doing so, the string "[Field 1]" would be placed in the app integration URL, which is apparently, bad syntax.

           

          I changed the variable's formula to this, and everything started working:

           

          If(Len(GetCurrentSelections()) = 0, Null(), 'select/' & GetCurrentSelections('/select/', '/', ';') & '/')

           

          GetCurrentSelections returns a string of all current selections in a format where you can find various delimiters. Check it out in the help file. It bypasses the issue I was having with using the square brackets to get selections for field names like "Field 1". Also, it simplifies your implementation, because you only have to reference the variable once for the entire URL rather than one time for each field that may have selections.

          • Re: How to use App Integration API when fields have spaces
            Aiham Azmeh

            Hi bbainsslalom,

             

            It should just work, try to URL encode by replacing the space with `%20`.

             

            Is it browser specific?