October 2010 Archives

I had a could things I needed for a project that weren't standard in the functions list. I googled around and snagged some java script code that works just fine and made a custom function that I reuse across many of my projects. Here is a quick tutorial and example of code.

-Asa

1. Create a new custom function.

CustomFunctionMenu.JPG





















2. Give the custom function a name. There is no input parameter required

CustomFunctionParameters.JPG






























3. Enter the code as shown below, which will return a valid guid to any string variable.

CustomFunction.JPG






























Code:

var s = [], itoh = '0123456789ABCDEF';

  for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10);

  s[14] = 4;
  s[19] = (s[19] & 0x3) | 0x8;

  for (var i = 0; i <36; i++) s[i] = itoh[s[i]];

  s[8] = s[13] = s[18] = s[23] = '-';

  return s.join('');



About this Archive

This page is an archive of entries from October 2010 listed from newest to oldest.

April 2013 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages

Powered by Movable Type 5.01