4 Replies Latest reply: Nov 16, 2012 9:56 AM by Jes Hynes RSS

    VBScript function as DynamicImage Source

    Jes Hynes

      Hi Follks,

       

      The above says it all really but for further clarification.  I'm running Qlikview behind a firewall and am utilising GoogleMaps For Business (ie, I have a license).  I've created a webservice that returns a signed url and I've written a vbscript that consumes that webservice.

       

      Now all I need to do is to call that function and use its result as a charts dynamic image source.

       

      In the "What's new in Qlikview 11" example, the customer tab has a chart where the dynamic image is recorded as :

       

      ='http://maps.google.com/staticmap?center='
      &
      num(var_mid_lat, '##############', '.', ',' )
      &
      ','
      &
      num(var_mid_long, '##############', '.', ',' )
      &
      '&zoom=$(var_zoom)'
      &
      '&size='&
      map_size_x&'x'&map_size_y
      &
      '&key='&
      gmap_key
      &
      '&maptype='&
      var_maptype
      & '.jpg'

       

      What I need to do is to replace that with =myfunction(lat, lng) where lat and lng relate to the variables var_mid_Lat & var_mid_Lng already defined in the example.  This would return a url similar to:

       

      http://maps.googleapis.com/maps/api/staticmap?center=MyAddress&channel=TestGet&zoom=10&size=600x300&maptype=roadmap&sensor=false&client=gme-clientId&signature=GqPJ9aLU3KZW9UxtDgbv0wX9pGk=

       

      Can anyone please explain how to do this?  I've tested that the URL I'm passing back actually works (the above is an example) I just need to be able to call the function that produces it.

       

      Thanks,

       

      Jes

        • Re: VBScript function as DynamicImage Source
          Brian Munz

          I'm not great at VBScript but are you sure that the users of this app will only be viewing it in Internet Explorer or in Webview on the desktop client?  Only IE natively supports vbscript.

            • Re: VBScript function as DynamicImage Source
              Jes Hynes

              Hi Brian,

               

              Thanks for the response.  As far as I'm aware this will be in controlled, IE only environment, so no concerns there.

               

              I've progressed a bit (I think) in that I've created a couple of functions in the Edit Module screen which I think I should be able to access:

               

              Unfortunately, one of them contains the line

              set xmlobj = server.CreateObject("MSXML2.ServerXMLHTTP.3.0")

               

              and this is bringing back the error:

              Object required: 'server'

               

              (I've tried changing to 'Server' but to no avail).

               

              Any thoughts on how I overcome this?

               

              Thanks,

               

              Jes

                • Re: VBScript function as DynamicImage Source
                  Jes Hynes

                  Hi Folks,

                   

                  Ok, I've removed the server. prefix and enabled all access within security, etc, and now it parses fine.  However, I'm getting no values returned from the function into my dynamic image, even when changing the function to simpl return a string value.

                   

                  It appears that I can't use functions as a source for dynamic images - how do I get around this?

                   

                  I am losing the will to live here

                   

                  Later,

                   

                  Jes

                    • Re: VBScript function as DynamicImage Source
                      Jes Hynes

                      Hi Folks,

                       

                      Another step forward...

                       

                      I've created my functions in the module editor, then under the edit script window I've referenced those functions and it seems now I''ve been able to place the returned value as the title of the chart! 

                       

                      It's not fully dynamic yet as it's not yet accepting parameters nor displaying the map, but I've got this far and it's made me happy (or at least I've taken my head out of the oven!)

                       

                      I'll continue on Monday.  Have a great weekend everyone.

                       

                      Later,

                       

                      Jes