Page 1 of 1

System_ComObject error when sorting with Javascript Gatherer

Posted: Tue Aug 30, 2011 11:18 pm
by cj-a-min
Your article on Minimal JavaScript for non programmers tutorial, was very informative. But, I don't believe it addressed my issue in sorting the variables.

I am extracting names like this, Doe, John. I need to convert this to John Doe:

My JavaScript gatherer, with limited knowledge on Javascript. And using your built in text-gatherer feature I was able to code this:

Code: Select all

//returns the first name, using the space as the delimiter
var step0_result = element.innerText.replace(/\r\n/g, "\n");
var step1_slices = step0_result.split(" ");
var step1_result = step1_slices[1];
//returns the last name, using the comma as the delimiter
var step2_result = element.innerText.replace(/\r\n/g, "\n");
var step3_slices = step2_result.split(",");
var step3_result = step3_slices[0];
//Now I need sorted, on the return like so, but this doesn't work
return [step1_result,step3_result];
With above code I get System_ComObject error.

However, when using :

Code: Select all

return step1_result;
Instead of:

Code: Select all

return [step1_result,step3_result];
It works, but only gives me first name.

How do I code this to work , and return John Doe? Or maybe i'm on the wrong track altogether. Or maybe there is a another solution using a different javascript?

Re: System_ComObject error when sorting with Javascript Gath

Posted: Wed Aug 31, 2011 5:00 am
by cj-a-min
OK using your "Minimal JavaScript for non programmers tutorial", I solved it.

In case anyone needs it:

Code: Select all

return step1_result + " " + step3_result;
I am always learning...Thanks for facilitating this... :D