Saturday, 15 September 2012

javascript - Apps Script - splitting google form checkbox answers by commas -


The Google Forms checkbox question adds a comma-separated column in the selected column. I am trying to send a confirmation email to these responses, but email results in a clunk format:

Register: 9:15 am - 10:00 AM teaching equipment & amp; Tools for processing (electronic lab notebooks, class technology, analytics, etc.), 10:10 am - 11:00 am or hybrid (mixed) course (glass of learning, instructional design, ted, podcast, etc.)

I would like the coma separator to & lt; Br> , but are not able to understand it.

I have tried:

  register = e.namevalues ​​[header [4]]. the division (','); Register = e.namedValues ​​[Header [4]]; Workshops = register.rele (",", "
");

Any help would be greatly appreciated! Thanks!

for header (header i) {....... ..... register = e.namedValues ​​[header [header] [4]]; } If (E. Named Value [Header [i]]. ToString ()! = "") {Textbody = ....... + register + "
}

should be structured like this:

  For (header in var i) {....... ..... register = e.namedValues ​​[header [i]]. ToString (); If (register! = "") {Textbody = register.replace (/, / g, "& lt; br>;); }}  

After converting the array to a string, you must make a global replacement.

  function replaceCommas () {var headers = ['first name', 'timestamp', 'last name', 'workshops']; Var Register = {'First Name': ['Jane', 'Zone', 'Jim', 'Josie'], 'Timestamp': ['6/7/2015 20:54:13'], 'Last Name' : ['Doo'], 'Workshops': ['Learning Glass', 'Instructional Design', 'Ted', 'Podcast']}; // register = e.namedValues ​​[header [4]]. the division (','); Var keyname = header [3]; // array is zero-indexed, the fourth item is index 3 logger.log ('keyName is:' + keyName); Var stringOfValues ​​= Register [keyName] .toString (); Logger.log ('stringOfValues:' + stringOfValues); Var Workshops = StringOfwall Place (/, / g, "& lt; br & gt;"); Logger.log ('Workshops:' + Workshops); }  

Copy the above function to your script editor, first set a breakpoint on something like the Logger.log () statement, and step in each line . You can see all the values ​​of variables in the debug window at the bottom of the screen.

To set a breakpoint, click on a line number, and a red dot will appear, that will be where the code will be closed. Then click on the bug's icon, the code will run until the point of breakpoint.

Here is a link to the debug documentation:


No comments:

Post a Comment