How to get and change values in Wiser Filter via Javascript

Comments

3 comments

  • Avatar
    Ravid Paldi (Edited )

    Hi Bryan, 

     

    If it's a constant number of 0s then I would suggest doing it via the cube rather then JS.

    The flow is fairly simple:

    - Add a new column to the dim that you currently use to hold the trimed number (use the SUBSTRING(string,index,length) to do so) 

    - Set the WiserFilter and other widgets to work agaisnt that column instead of the orignal "drity" column with the zeros. 

     

    If the number of zeros is not constant then you won't be able to do that cube trick. 

    In that case I would advise to do a JS plugin that will intercept the query results of all widgets and trimm down the zeros before they are being presented within the widget.

    Its a fairly small project. We can help out if needed. Feel free to ask for questions if you go with that approach. We're happy to help (: 

     

     

    By the way, we've recently launched a new premium plugin to the marktplace named AdvancedFilters with many UI and functinality enhancments. 

    About the plugin in a nutshell:

    - It is officialy supproted for both windows and linux disributions for all Sisense versions that where released within the past 12 months (currnetly 7.4 and above and all Linux versions) 

    - Option to switchi between single/Mutli selection and even date range if its a date field 

    - Abilty to easilt search & select values

    - Abilty to plot multiple dropdowns within one widget in any layout you'de like

    - Abilty to add/remove an apply button

    - Many styling options together with a modern UI design that comes bundeled out of the box

    - Our own propeorty mechanism for dependent filter so you could define multiple children for a single dimension, even for a date range (for example, you can select a date range and the child dimenstions will be automatically filtered only with values that are relevent for the seleted range) 

    - More features and enhacments down the road - feel free to send us feedbacks and feature requiests. 

    - Trial is available so you can test it on your env' before purchasing

     

    Feel free to reach out for a live demo and a trial version,

    ravid@paldi.solutions

    Paldi Solutions 

     

    0
    Comment actions Permalink
  • Avatar
    Bryan Register (Edited )

    Thanks for following up Ravi!

    I was actually able to make progress on changing the values that show up in the Wiser filter with this code:

     

    widget.on('processresult', function(se,ev){

     

    ev.result[0].text= "2-20"

    ev.result[1].text= "21-100"

    ev.result[2].text= "101-300"

    ev.result[3].text= "301+"

    ev.result[4].text= "501+"

    ev.result[5].text= "1000+"

     

    })

     

    The problem that I'm running into now is that this changes the way the data displays in the dropdown, but it also changes the values of the filters themselves. Since that value won't match the value in the original column in the cube, no data will show up in the charts when the filter is selected.

     

    I thought that just changing the ".text" portion, and not the ".data" portion of ev.result[i] would only change the label.

     

    Any ideas on how to just change the label, and not the underlying data?

    0
    Comment actions Permalink
  • Avatar
    Ravid Paldi

    You're welcome Bryan, 

     

    We're not very familer with the Wiser filter code too much but it sounds to me that you're assumption is good as usaulyl web componenet keep the two fields seprate

    (the main reason we decided to launch and official and upgraded premium plugin for this is because we've got several customizations requests and the plugin's code is not very "modern" and easy to work with) 

    I'm guessing that this behavior is because somewhere in the code the developer is using the text field instead of the data field when they populate the values to the Sisense filter so I would do a search of the code for .text and see where that part happen and simply switch them. 

    If that doesn't work, you'r only option is to try and find some sort of an "itemSelected" event or "dialogClosed" (or any equivielent) and try to map back the selection into the proper filter members that should be entered. 

     

    Again, if possible, I highly suggest to do that change within the cube. It will take you less then 30m of cube setup, won't impact other dahsboards and will be much user friendly for additioanl designers who would need to work with the filter as well. 

     

    Good luck and keep us posted when you find a solution (: 

    Ravid

     

    0
    Comment actions Permalink

Please sign in to leave a comment.