My first extension – Hausdorff Distance

    I am conscious that there are lots of excellent write-ups of going through the learning curve of building an object extension, many of which I have found and helped as I have gone through the learning curve myself. So, I am standing on the shoulders of giants in sharing my pain points going through this for the first time.

     

    I avoided integration with D3/SVG as there are several folks who have covered that well already (although wished I had read sooner, before a recent interview where one of the questioners said with a straight face that they used tableau given its better range of visualisations …).

     

    So, I revisited something I had modelled a couple of years ago. Caveat; I am conscious that problems that might suit the Hausdorff Distance, which is a max-min approach to coming up with a distance measure between sets, probably have better candidates utilising integration with R/Python.

     

    But still as a small project that could teach/test myself;

    1) How to set up an object extension

    2) Dig up my Java scripting/HTML skills (which had gone a bit stale through lack of use) to manipulate the data & return something (although I think my code is probably less efficient than it could be)

    3) Link in with something I had modelled before & could therefore test the numbers on

     

    My key pain points were;

    1) All coding is exacting, by its nature one misplaced bracket can make the whole thing crash or worse; however I found the start point for the extension quite hard to pick out of the noise of looking at other people’s work (apologies to all those I looked at, once folks have bolted in/on the code required to do some of the more funky stuff that people will expect an extension to do there can be a lot there) – on in my script.js lines 1, 73, 113 and 127 are key in that regard, then (at least in Visual Studio) intelli-sense helps keep the guts of the code (3-71, 78-125) from getting out of line. I only found this later

     

    2) Initially I have never opened and closed QlikView as much, occasionally would glitch on closing (I suspect when I had left something dodgy in the Javascript), if I switched out of WebView – it would then allow me to save (although generally I could just kill it with task manager, given my application rarely changed)

     

    3) For my model to allow selections I came up with the workaround of passing Only(Set) and using the universal set {1} on the numeric expressions, there may be a neater way of accessing the excluded set (effectively required, given I am trying to avoid doing the data-model manipulation I had done before);

    select.png

     

    4) I spent a lot of time deleting DynProperties.qvpp, quite a lot of which was around adding the text boxes to get the desired format for my output; ‘Output Number Format’ and ‘Decimal/Precision’ text boxes into my Definition.xml file, which seemed to struggle to stick & between closing & re-opening & using F5 to refresh extensions eventually got there (I did initially try 'select' to give a drop-down, but despite trying to add some work around code, here, could not get it to work, which is annoying as I suspect putting rubbish in my properties would break it quite effectively)

     

    5) And the final one was when putting a lot of data through it getting nothing back, that I tracked down (here) to needing to either change how the data was consumed, or add a (large numbered) PageHeight (as defaulted to 40) to my Definition.xml file, this does feel like a bit of a hack though