Help using a Google Spreadsheet with a script

dawarden

I was hoping to get help using Google Spreadsheet data with a script I have paste below. The script is a calculator/comparison tool, that compares movie rating with one another. Essentially, the scrip displays two drop down lists (both lists are identical), and you choose one movie in one drop down and another movie in other drop down, then you hit calculate. Inside the script, which you will see below, I have assigned values to each movie and as you can imagine, this becomes tedious. So what I would like to do is use a Google Drive Spreadsheet to almost power the data inside this script, so when the google spreadsheet is saved, the values change inside the script.

... as you can see, the data is pretty straight forward, and matches what's inside the script, however, given I'm forced to surround the data by '<option value=xx.xx> and '</option>, I am unsure how to allow the data on the spreadsheet to power this calc.

I. I would love to have the above script adjusted so that automatic saves on the Google Spreadsheet will just show up on the calc.
II. I essentially do not want to even have to open up my javascript file any longer, I'd like to just have to update my google spreadsheet

dawarden

dawarden

xelawho: Much appreciated on the info, however, I'm not following...

dawarden

And that spreadsheet should be published now, try again if you could?

xelawho

this seems to work - it goes a bit funny on the last option because you haven't given Die Hard 3 a rating. I put an alert in the onchange so you can see the values coming through. It's a bit of a low-rent way of looping through the columns, but I couldn't see another...

dawarden

xelawho:

I may have tested your code wrong, but my goal (and my javascript that i pasted above) has two different drop down lists, as my goal is allow the user to select one movie in one drop down list and another in the other drop down list (Even if the movies are the same)... if the same, the calculator will say that they are equal. It's a comparison calculator.

Any chance you could help me create this from what you made, or help me manipulate my javascript above to read the google spreadsheet? Thanks a ton!!!!!!!

So what I'm after:
1. Two drop down lists
2. Same identical lists in each drop down
3. The same movie being selected in each would call for an equal rating
4. Somehow have the calculator say what movie is better, or just repeat the values would be sufficient enough, as the user would know which is rated higher if it gave both values
5. I am wanting to just adjust the values inside the spreadsheet and again I only need one spreadsheet, as the drop down lists will again use the same data/list

xelawho

It's basically the same code, with another select and your function and html added. Here you go:

dawarden

xelawho: You are awesome! Thanks so much!!!!!! Last question, if i wanted it to compare 2 vs 2? So two drop downs "vs" 2 drop downs?

xelawho

Can you explain how you would compare 2 vs. 2?

dawarden

Sorry, what I mean is.

[ drop down list ] & [ drop down list ]

vs.

[ drop down list ] & [ drop down list ]

[ calculate ]

So:

[ Diehard 1 ] & [ X-Files ]

vs.

[ Diehard 2 ] & [ Diehard 3 ]

[ calculate ]

= This would suggest that the first two are better than the second two by, i think my math is right, 14 or so %... I know this seems overboard, but I'd use it for more than just 2 for 2 movie comparison calculations, so 2 for 2 would be the most ideal for me.

I can't thank you enough!

xelawho

so you make another 2 selects, fill the options the same way, add the selected values of 1 & 2 and 3 & 4 and compare them in the same way. Which bit are you having trouble with?

dawarden

Nope, figured out what I did wrong. Got it! Thanks so much, appreciate your help! You rock! This site rocks!