javascript - Splitting two comma delimited strings into itemized array -


i want create register of candidates have attended training on various topics. trainer completes google form , selects candidates checkbox list, , training topics checkbox list. result 2 comma delimited strings, want split itemized array follows:

original form response

| candidate            | training                    |   +----------------------+-----------------------------+   | peter, susan, john   | algebra, geometry, calculus |   

desired output:

| candidate    |  training  | +--------------+------------+   | peter        | algebra    | | peter        | geometry   | | peter        | calculus   | | susan        | algebra    | | susan        | geometry   | | susan        | calculus   | | john         | algebra    | | john         | geometry   | | john         | calculus   | 

there multiple form submissions, , trainers can submit more 1 response.

i have given go myself, i've come with: =arrayformula({transpose(trim(split(join(",", rept(c2:c&",", if(len(e2:e)>0, (len(e2:e)-len(substitute(e2:e, ",",""))+1),)) ),","))),transpose(trim(split(join(",", rept(e2:e&",", if(len(c2:c)>0, (len(c2:c)-len(substitute(c2:c, ",",""))+1),)) ),",")))})
splits , repeats both strings correct number of times, repeats in same order. implication of (with reference example in original question) following undesirable output:

| candidate    |  training  | +--------------+------------+   | peter        | algebra    | | susan        | geometry   | | john         | calculus   | | peter        | algebra    | | susan        | geometry   | | john         | calculus   | 

any advice? i'd sincerely appreciate anyone's this! in advance

you can jquery:

var url = "https://spreadsheets.google.com/feeds/cells/0amhywnfly1f-dg1othq5ss1uuzhvtnztshnzmjddave/od6/public/values?alt=json-in-script&callback=<your_callback>"; $.getjson(url,{}, function (d) { console.log(d); }); 

now "d" object...


Comments

Popular posts from this blog

Add new key value to json node in java -

javascript - Highcharts Synchronized charts with missing data points -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -