Visokio website     Downloads     Video tutorials     KnowledgeBase  
Ranking top x items - aggregated values - Visokio Forums
Ranking top x items - aggregated values
  •     bernardpi April 18, 2016 11:43AM
    Hi there. I have a content view where I have written Javascript to run through a list of items and aggregate on a field in order to be able to rank the items. In context, I'm running through a list of employee transactions (not-unique) and ranking them by total amount spent. This involves performing a subset sum on all employee transactions and then performing a sort and reverse to get my sorted list which I then use for downstream calculations.

    This is all done using for loops which aren't quick and results in the content view taking about 7000ms on a fast machine to load and on slow machines, Omniscope times out and the execution doesn't complete so the content view is blank.

    I am not sure how to use the RANK function to do this (if indeed it can) as the docs are a little confusing and there aren't many decent examples. I would like to keep the calculation in the content view if possible.

    Thanks for your help in advance,

  • 1 Comment
  •     paola April 18, 2016 12:15PM
    Please have a look at demo file and detailed explanation in this forum post, dealing with ranking of aggregated values. Not sure that you really need to use JS in the Content View for this, it might be more practical to use formula fields in the Table view or add them in the Field Organiser.


It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership