Answered

Top 6 Variables


Hello,

Im using typeform questions to generate a set of 10 numerical variables dependent on how they respond to two questions, is there a way to then determine what is the top 6 variables so I can calculate the sum of these.
Thanks in advance,

Niall

icon

Best answer by john.desborough 22 July 2022, 19:29

View original

4 replies

Userlevel 7
Badge +5

Hi @NBoyle Happy little Friday! Are you generating the top 6 based on what the respondent has answered with alone? Or based on the responses from everyone that has answered your form? 

Hi @Liz ,

The top 6 based on what the respondent has answered with alone.

Thanks,

Niall

Userlevel 7
Badge +5

Ah, I see. I don’t think we have an option like this, even with a workaround. @john.desborough have you ever built anything like this? 

Userlevel 7
Badge +6

@Liz @NBoyle - there isn’t an easy way to do this inside the logic rules at all.. just sayin’

i was faced with a client project that had 25 variables and they wanted to get the to 5 to pass over to their shopify cart page.

 

it’s not wonderfully pleasant to do all the code inside typeform’s logic rules to get to the top 1 value - essentially you have to evaluate each each variable to see if it is uniquely the highest - individually, in the first set of rules (ie is v1 gt v2 and v1 gt v3 and v1 gt v4 etc… and IF it is uniquely the highest set v1_highest = yes… and do this for each one) 

if there is nothing that is uniquely highest you can use rules to evaluate how many times v1 is higher than other variables, adding 1 to a separate variable (ie v1_ishigher_than) and then look at which vx_ishigher_than variable score to which variable is higher.. 

but what happens if there is a tie for high score? that is another issue

just to get that done to are 2 tied or 3 tied, is a lot of additional rules as well. 

 

NOW if you want to try and get the top 6, you could do this by going from highest score down or from lowest score up - ie reverse the logic approach in the example above → if you did the lowest up, you would only have to the following sort of gyrations for 4 values and not 6… just sayin

the gyrations:

  • you would need to use the framework above to determine highest (or lowest) score and then remove that variable from the next round of calculations - the question is how do you do that ?? if v1 was the unique highest score, then you would have do the ‘which is highest out of v2-v10? ie run the logic to determine v2_ishigher_than score being higher than the others.. and then removing the next highest variable out of the 3 round of processing 
  • repeat for 3rd highest/lowest.. etc. 

Not really fun at all.. and I have NOT been able to make this work in typeform as of yet - i have spent a number of hours working on it and had to draw the line at making it work cuz it was ‘eating my life’

I even tried to do this inside Google Sheets after connecting the typeform - all the data is in a row for the form entry. all of the Google (and Excel) functions to RANK, SORT etc work on columnar data and not row data .. conceptually you would have to do an arraytranspose on the row data into a column in order to then do the rank/sort function and then do another arraytranspose to write the ‘result data’ into a new set of columns in your data row… That’s how it would work conceptually but my wizardry and appetite to try and make it work ran out of time and no paying client to cover the cost of the ‘research’ it would take to do it. 

You SHOULD be able to use the API/Webhooks to push the data into a database and run something there and pull it back into your process BUT that is not ‘my jam’. You should be able to do that with some python coding as well - again ‘fruitless’ for me to do this .. 

Pushing it into Google Data Studio may work better to make it all come out in the wash but I just don’t have the time to do that testing at this point. 

 

and after all that yadda yadda… i hope it doesn’t scare you off.. 

I would check with @picsoung at Typeform to see if he has some programmatic way of doing the ‘ranking’ with the webhooks/API approach .. cuz this would solve many problems 

 

des

 

 

Reply