Getting function Expected when tyring to use reverse()

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Getting function Expected when tyring to use reverse()

Post by azbob » Wed Jun 28, 2017 3:42 am

Configuration: Surface Pro 2, Win 10, Firefox 53, iMacros Standard Edition (x86) Version 11.0.246.4051
Hi,
I am trying to split out the house address from the total extract.
The Web page HTML has a line break<br> between the name line section and start of address, but when extracted it doesn't appear as extracted=HTM shows the two fields run together "<SP>lastnamehousenumber<SP>" with no delimiter. However, I was able to split them using regex on white space.
Since the address fields are always represented the same way my goal is to separate house address, reverse it and split by index, o being zip, 1 being state, 2 being city and 3 the address. That way I don't have to worry about complex address parsing.

Here is the code I have so far.

Code: Select all

VERSION BUILD=11.0.246.4051
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
'URL GOTO=https://www.protk.com/ProTeck.LocalVendor.Web/Home/Show?pageName=Cases
FRAME F=1
TAG POS=2 TYPE=TD ATTR=CLASS:ReportManagerTable_rows EXTRACT=TXT
SET Trim_spces EVAL("var x,y,z; x=\"{{!EXTRACT}}\"; y=x.replace(/^\\s+|\\s+$/gm,'');y;")
SET Split_spce EVAL("var w,x,y,z; w = \"{{!EXTRACT}}\"; y = w.split(' ');y;")
SET raw_address EVAL("var x,y,z; x = '{{!EXTRACT}}'; y = x.replace(',',' ');y;")
'***************************GET RID OF WHITE SPACE BETWEEN NAME LINE AND HOUSE NUMBER*********************************************
SET Sub_split_NME_NBR EVAL(" var a,x,y,z;  x = '{{Split_spce}}'; y=x.split(/\\s/g); z = y[1];z;")
'**********TRIM WHITESPACES AT BEGINNING AND END OF STRING ADDRESS******************************************************
SET Trim_spces EVAL("var x,y,z; x=\"{{Sub_split_NME_NBR}}\"; y=x.replace(/^\\s+|\\s+$/gm,'');y;")
SET Rev_addr EVAL("var x,y,z; x = '{{Sub_split_NME_NBR}}'; z = x.reverse(); z;")
Here is the error code I get and it must have to do with the reverse() looking like a function call(?). I can't figure out how to get around it.

Code: Select all

Error -1250: JScript statement in EVAL contains the following error: Function expected. Line 23: SET Rev_addr EVAL("var x,y,z; x = '{{Sub_split_NME_NBR}}'; z = x.reverse(); z;")
I have attached a JPG with the "PROMPT" records for the !EXTRACT and variables.
Thanks
Attachments
!EXTRACT and variables contents
!EXTRACT and variables contents
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Getting function Expected when tyring to use reverse()

Post by chivracq » Wed Jun 28, 2017 4:46 am

azbob wrote:Configuration:

Code: Select all

Surface Pro 2, Win 10, Firefox 53, iMacros Standard Edition (x86) Version 11.0.246.4051
Hi,
I am trying to split out the house address from the total extract.
The Web page HTML has a line break<br> between the name line section and start of address, but when extracted it doesn't appear as extracted=HTM shows the two fields run together "<SP>lastnamehousenumber<SP>" with no delimiter. However, I was able to split them using regex on white space.
Since the address fields are always represented the same way my goal is to separate house address, reverse it and split by index, o being zip, 1 being state, 2 being city and 3 the address. That way I don't have to worry about complex address parsing.

Here is the code I have so far.

Code: Select all

VERSION BUILD=11.0.246.4051
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
'URL GOTO=https://www.protk.com/ProTeck.LocalVendor.Web/Home/Show?pageName=Cases
FRAME F=1
TAG POS=2 TYPE=TD ATTR=CLASS:ReportManagerTable_rows EXTRACT=TXT
SET Trim_spces EVAL("var x,y,z; x=\"{{!EXTRACT}}\"; y=x.replace(/^\\s+|\\s+$/gm,'');y;")
SET Split_spce EVAL("var w,x,y,z; w = \"{{!EXTRACT}}\"; y = w.split(' ');y;")
SET raw_address EVAL("var x,y,z; x = '{{!EXTRACT}}'; y = x.replace(',',' ');y;")
'***************************GET RID OF WHITE SPACE BETWEEN NAME LINE AND HOUSE NUMBER*********************************************
SET Sub_split_NME_NBR EVAL(" var a,x,y,z;  x = '{{Split_spce}}'; y=x.split(/\\s/g); z = y[1];z;")
'**********TRIM WHITESPACES AT BEGINNING AND END OF STRING ADDRESS******************************************************
SET Trim_spces EVAL("var x,y,z; x=\"{{Sub_split_NME_NBR}}\"; y=x.replace(/^\\s+|\\s+$/gm,'');y;")
SET Rev_addr EVAL("var x,y,z; x = '{{Sub_split_NME_NBR}}'; z = x.reverse(); z;")
Here is the error code I get and it must have to do with the reverse() looking like a function call(?). I can't figure out how to get around it.

Code: Select all

Error -1250: JScript statement in EVAL contains the following error: Function expected. Line 23: SET Rev_addr EVAL("var x,y,z; x = '{{Sub_split_NME_NBR}}'; z = x.reverse(); z;")
I have attached a JPG with the "PROMPT" records for the !EXTRACT and variables.
Thanks
Oh yeah, oh yeah...!, what a "mess" I have the feeling..., ah-ah...! (No offense...!) But Compliments that you are trying to get your Solution by yourself, this is exactly what I was/am doing as well, ah-ah...!

Hum, tried to have a look at your Site/Page but it's behind Login&Password, any chance you can upload a Saveas of your Page...? (Maybe x2 or x3 as I guess I would need to see what might change between several Records...)
Or at least the exact Content of the/each 'EXTRACT'... Then I guess I can recognize how an Address looks and understand how you want to "separate" it... Oh, but you use the 'EXTRACT=TXT', hum and the 'EXTRACT=HTM' as well... But don't you have several 'DIV' or 'SPAN' Elements within that 'TD' Element...?
I think I've already done more complex Data Manipulations and I don't think I ever needed more than 2 Lines... and I never use 'REGEX' and Global Switches... Your Script is not to follow...!
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Re: Getting function Expected when tyring to use reverse()

Post by azbob » Wed Jun 28, 2017 6:54 pm

Well yea I work out the problem with different approaches trying for working solution. After that I work on refining. Haven't got to the solution part yet. On this one the HTML what is extracted was different.Here is HTML.( I have attached copy of page)

Code: Select all

<td class="ReportManagerTable_rows">
						JOHN R GRAY II<br>4965 E Red Range Way   CAVE CREEK,AZ 85331<img src="/images/spacer1.gif" width="1" height="1" border="0">
					</td>
When using "extract=txt" the <br> is turned into whitespace:
JOHN R GRAY II
4965 E Red Range Way CAVE CREEK,AZ 85331

If I use "extract=HTM":

Code: Select all

TAG POS=1 TYPE=TD ATTR=TXT:JOHN<SP>R<SP>GRAY<SP>[u]II4965[/u]<SP>E<SP>Red<SP>Range<SP>Way<SP>CAVE<SP>CREEK,AZ<SP>85331 EXTRACT=HTM
The end of name field and house number are run together.
So...Hence my messing around splits etc. was to try to separate that...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Getting function Expected when tyring to use reverse()

Post by chivracq » Wed Jun 28, 2017 8:11 pm

azbob wrote:Well yea I work out the problem with different approaches trying for working solution. After that I work on refining. Haven't got to the solution part yet. On this one the HTML what is extracted was different.Here is HTML.( I have attached copy of page)

Code: Select all

<td class="ReportManagerTable_rows">
						JOHN R GRAY II<br>4965 E Red Range Way   CAVE CREEK,AZ 85331<img src="/images/spacer1.gif" width="1" height="1" border="0">
					</td>
When using "extract=txt" the <br> is turned into whitespace:

Code: Select all

JOHN R GRAY II
4965 E Red Range Way CAVE CREEK,AZ 85331 
If I use "extract=HTM":

Code: Select all

TAG POS=1 TYPE=TD ATTR=TXT:JOHN<SP>R<SP>GRAY<SP>[u]II4965[/u]<SP>E<SP>Red<SP>Range<SP>Way<SP>CAVE<SP>CREEK,AZ<SP>85331 EXTRACT=HTM
The end of name field and house number are run together.
So...Hence my messing around splits etc. was to try to separate that...
Yep, (one) Solution found (and there are probably quite a few others I reckon...), in just 1 one Line in one fairly simple 'EVAL()' Statement, in less than a minute... :oops: There is indeed some mini-Difficulty related to the '<BR>' Tag but the first "thing" I try works directly... 8)
Hum, and I discovered some probable Bug that could turn into some interesting "Feature", ah-ah...! :twisted:

But hum..., I'll post "my Solution" if you can mention your FCI in your parallel Thread on SOF... :idea:
(Main Reason why I rarely answer(ed) Threads on SOF where Users practically never mention their FCI, and I don't like their stupid (fake) Reputation System, ah-ah...! :roll: )

No Pb to open parallel Threads on different Forums but I consider you must maintain them all and strive for the same "Quality" on them all..., I thought I had already asked you for your previous Thread where FCI is still missing and that you didn't finish "neatly" by sharing your Sol, with maybe a Link to your parallel Thread on this Forum... [To-Do as well, ah-ah...!]
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Re: Getting function Expected when tyring to use reverse()

Post by azbob » Wed Jun 28, 2017 11:43 pm

Sure ..What does FCI mean??
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Re: Getting function Expected when tyring to use reverse()

Post by azbob » Wed Jun 28, 2017 11:48 pm

Also I don't know how to link between threads sooo...let me know an i'll be glad too.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Getting function Expected when tyring to use reverse()

Post by chivracq » Thu Jun 29, 2017 12:12 am

azbob wrote:Sure ..What does FCI mean??
Euh..., are you serious...!? FCI = "Full Config Info", explained in my Sig = Info about your Environment that you always mention neatly on this Forum each time you open a Thread (I wouldn't answer your Threads each time otherwise...), probably after I "kicked your ass" once or twice before, I reckon..., ah-ah...! :twisted:
azbob wrote:Also I don't know how to link between threads sooo...let me know an i'll be glad too.
Pff, dunno really, just post the Title of the Thread and the Link I would think..., if it's not good enough, some other User on SOF will edit your Post..., but don't worry, I'm not looking for any "Recognition", if posting a Link to your parallel Thread on this Forum is too complicated, simply post the Content..., to make your Thread on SOF useful for other Users..., that's the "Purpose" of my Remark... Internet and all Forums are just one big "Family", ah-ah...! (That's how I know directly IRT if you open any parallel Thread on SOF or some other Forum..., and believe me, I don't go searching for them... :shock: )
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Getting function Expected when tyring to use reverse()

Post by chivracq » Thu Jun 29, 2017 12:30 am

But, OK, I don't want to "blackmail" you, I trust you will improve the "Quality" of your 2 Threads on SOF, here is my Sol:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX

SET !EXTRACT "<td class=\"ReportManagerTable_rows\">                  JOHN R GRAY II<br>4965 E Red Range Way   CAVE CREEK,AZ 85331<img src=\"/images/spacer1.gif\" width=\"1\" height=\"1\" border=\"0\">               </td>"
'PROMPT _{{!EXTRACT}}_            
               
SET Name EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[0].split('>'); z=y[1].trim(); z;")
SET Address EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[1].split('<img'); z=y[0].trim(); z;")
PROMPT Name:<SP>_{{Name}}_<BR>Address:<SP>_{{Address}}_
(Tested on iMacros for FF v8.8.2, PM v26.3.3 (=FF47), Win10-x64.)

Result of the 'PROMPT':
Name: _JOHN R GRAY II_
Address: _4965 E Red Range Way CAVE CREEK,AZ 85331_
The 'trim()' for the 'Address' is not even needed, it was only meant as a "parallel" for the 'Name' and/or as an "Excuse" to use the 'y' Var, ah-ah...!
One Line I said (on 'EXTRACT=HTM'):

Code: Select all

SET Address EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[1].split('<img'); z=y[0].trim(); z;")
Oh but yep, I mentioned there was a 'mini-Difficulty related to '<BR>', it seems that a 'split()' "backward" on '<BR>' doesn't work (seems to work like a 'replace()' from my "less than 1 min" Testing, so I didn't investigate very much and I stopped directly as soon as I found a working Sol), that's why I first split on '<BR>' and kept splitting forward...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Re: Getting function Expected when tyring to use reverse()

Post by azbob » Thu Jun 29, 2017 12:59 am

I assumed the "SET !EXTRACT "<td class=....." line was just to set value for test??? Right
I'm thinking this is final code??

Code: Select all

VERSION BUILD=11.0.246.4051
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
TAG POS=2 TYPE=TD ATTR=CLASS:ReportManagerTable_rows EXTRACT=TXT
PROMPT _{{!EXTRACT}}_           
SET Name EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[0].split('>'); z=y[1].trim(); z;")
SET Address EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[1].split('<img'); z=y[0].trim(); z;")
PROMPT Name:<SP>_{{Name}}_<BR>Address:<SP>_{{Address}}
When I ran I got..
TypeError: y[1] is undefined, line 7 (Error code: -1001)
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Getting function Expected when tyring to use reverse()

Post by chivracq » Thu Jun 29, 2017 1:20 am

azbob wrote:I assumed the "SET !EXTRACT "<td class=....." line was just to set value for test??? Right
I'm thinking this is final code??

Code: Select all

VERSION BUILD=11.0.246.4051
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
TAG POS=2 TYPE=TD ATTR=CLASS:ReportManagerTable_rows EXTRACT=TXT
PROMPT _{{!EXTRACT}}_           
SET Name EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[0].split('>'); z=y[1].trim(); z;")
SET Address EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[1].split('<img'); z=y[0].trim(); z;")
PROMPT Name:<SP>_{{Name}}_<BR>Address:<SP>_{{Address}}
When I ran I got..
TypeError: y[1] is undefined, line 7 (Error code: -1001)
Yep, you "assumed" right, I don't have Access to you Page, so I assigned to '!EXTRACT' what I think comes from your Extract...
I would need your "real" Page to do some "proper" Testing, I'm doing my best but I'm a bit in the "Dark", ah-ah...! :idea:

Your "Extract" is probably different than "mine, I did my best to try to "guess" the proper one...

Oh, but no, wait...!!!, I said "EXTRACT=HTM"...!, not "=TXT"...! :roll:
Last edited by chivracq on Fri Mar 02, 2018 10:44 pm, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Re: Getting function Expected when tyring to use reverse()

Post by azbob » Thu Jun 29, 2017 2:22 am

Sorry my Bad. I'm unfamiliar with the use /syntax of extract=HTM
I thought it was more complicated then just replacing TXT with HTM.
So this works:

Code: Select all

TAG POS=2 TYPE=TD ATTR=CLASS:ReportManagerTable_rows EXTRACT=HTM
PROMPT _{{!EXTRACT}}_           
SET Name EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[0].split('>'); z=y[1].trim(); y;")
SET Address EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[1].split('<img'); z=y[0].trim(); z;")
PROMPT Name:<SP>_{{Name}}_<BR>Address:<SP>_{{Address}}
!EXTRACT:

Code: Select all

_<td class="ReportManagerTable_rows" style="outline: 1px solid blue;">       JOHN R GRAY II
4965 E Red Range Way   CAVE CREEK,AZ 85331<img src="/images/spacer1.gif" width="1" height="1" border="0">      </td>_
NAME:

Code: Select all

Name: _<td class="ReportManagerTable_rows" style="outline: 1px solid blue;",       JOHN R GRAY II_
Address: _4965 E Red Range Way CAVE CREEK,AZ 85331_

Code: Select all

Address: _4965 E Red Range Way   CAVE CREEK,AZ 85331_
I'll mess with the NAME to get it pure, but no biggie cause I only need address.
Thanks.

Now back to my, "Function Expected" error when I tried to reverse() address any ideas??
wanted to get: 85331,AZ,CAVE CREEK, Way Range Red E 4965

Code: Select all

SET Rev_addr EVAL("var x,y,z; x = '{{Sub_split_NME_NBR}}'; z = x.reverse(); z;")
Error -1250: JScript statement in EVAL contains the following error: Function expected. Line 23: SET Rev_addr EVAL("var x,y,z; x = '{{Sub_split_NME_NBR}}'; z = x.reverse(); z;")
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Re: Getting function Expected when tyring to use reverse()

Post by azbob » Thu Jun 29, 2017 2:54 am

Well hold on a minute, is there an easier way to split address into it's 4 components of
House address, city, state and zip from the back to front??
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Getting function Expected when tyring to use reverse()

Post by chivracq » Thu Jun 29, 2017 4:19 am

azbob wrote:Sorry my Bad. I'm unfamiliar with the use /syntax of extract=HTM
I thought it was more complicated then just replacing TXT with HTM.
So this works:

Code: Select all

TAG POS=2 TYPE=TD ATTR=CLASS:ReportManagerTable_rows EXTRACT=HTM
PROMPT _{{!EXTRACT}}_           
SET Name EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[0].split('>'); z=y[1].trim(); y;")
SET Address EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[1].split('<img'); z=y[0].trim(); z;")
PROMPT Name:<SP>_{{Name}}_<BR>Address:<SP>_{{Address}}
!EXTRACT:

Code: Select all

_<td class="ReportManagerTable_rows" style="outline: 1px solid blue;">       JOHN R GRAY II
4965 E Red Range Way   CAVE CREEK,AZ 85331<img src="/images/spacer1.gif" width="1" height="1" border="0">      </td>_
NAME:

Code: Select all

Name: _<td class="ReportManagerTable_rows" style="outline: 1px solid blue;",       JOHN R GRAY II_
Address: _4965 E Red Range Way CAVE CREEK,AZ 85331_

Code: Select all

Address: _4965 E Red Range Way   CAVE CREEK,AZ 85331_
I'll mess with the NAME to get it pure, but no biggie cause I only need address.
Thanks.

Now back to my, "Function Expected" error when I tried to reverse() address any ideas??
wanted to get: 85331,AZ,CAVE CREEK, Way Range Red E 4965

Code: Select all

SET Rev_addr EVAL("var x,y,z; x = '{{Sub_split_NME_NBR}}'; z = x.reverse(); z;")
Error -1250: JScript statement in EVAL contains the following error: Function expected. Line 23: SET Rev_addr EVAL("var x,y,z; x = '{{Sub_split_NME_NBR}}'; z = x.reverse(); z;")
Hum, strange on the Name, you seem to be "hitting" the same what I called "mini-Difficulty" on what I thought was the '<BR>' for Backward Splitting but maybe simply concerns the '>'..., then I guess this one will work for you... (I cannot test...):

Code: Select all

TAG POS=2 TYPE=TD ATTR=CLASS:ReportManagerTable_rows EXTRACT=HTM
PROMPT _{{!EXTRACT}}_           
SET Name1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[0].split('>'); z=y[1].trim(); z;")
SET Name2 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('>'); y=x[1].split('<'); z=y[0].trim(); z;")
SET Address EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[1].split('<img'); z=y[0].trim(); z;")
PROMPT Name1:<SP>_{{Name1}}_<BR>Name2:<SP>_{{Name2}}_<BR>Address:<SP>_{{Address}}
I would expect 'Name2' to be OK...?

EDIT: But no, my Script was correct I think, you modified it with 'y'/'z', you need to return 'y[1]' like I did if you don't want to use 'z'...
=> And not only 'y', which is still an Array...!! (And contains 2 Elements..., separated indeed by a Comma...)

>>>

About your 'reverse()' Function, pfffff..., dunno, from what I can follow from your Code, you were taking a String, split into an Array, until there OK, but then split the Array (no idea what that gives, ah-ah...!), keeping one Item from that "Result", to split it again, arrrggghhh...!, and trying to apply your 'reverse()' Command which is meant to be applied on Arrays, but you were already at an Array of the 2nd or 3rd "Dimension", ah-ah...!
azbob wrote:Well hold on a minute, is there an easier way to split address into it's 4 components of
House address, city, state and zip from the back to front??
Well, yep, split on Space I would think (on "my"...! Result which is a String, then 'split()' will give you an Array, ah-ah...!) and you can then use your 'reverse()' Function, but you might need to use some "sub" 'join()' for the Street for example, based on the Length of the Array...

>>>

OK, I saw you updated your 2 Threads on SOF, perfect... And yep indeed, for the 'Dynamic Frame' Thread, you linked directly to a post where I had asked you indeed to mention your FCI in that SOF-Thread, and to share your Sol..., ah-ah...! Never too late thus, ah-ah...! (FCI still not mentioned in that Thread, but OK, don't worry, everything is good enough, you really did your best, ah-ah...! Sorry, I can be a pain in the ass, I know...! :oops: )
Last edited by chivracq on Fri Mar 02, 2018 10:46 pm, edited 1 time in total.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Re: Getting function Expected when tyring to use reverse()

Post by azbob » Thu Jun 29, 2017 4:40 am

I get these errors when I run the new code:

Code: Select all

Error -1250: JScript statement in EVAL contains the following error: Function expected. Line 8: SET Name1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('<br>'); y=x[0].split('>'); z=y[1].trim(); z;")
Error -1250: JScript statement in EVAL contains the following error: Function expected. Line 9: SET Name2 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.split('>'); y=x[1].split('<'); z=y[0].trim(); z;")
azbob
Posts: 85
Joined: Mon Sep 21, 2009 6:16 pm

Re: Getting function Expected when tyring to use reverse()

Post by azbob » Thu Jun 29, 2017 4:45 am

Let me qualify that I got those errors when I ran it in Imacros Browser.
When I run in firefox it works, How come??

Code: Select all

Name1: ___undefined___
Name2: _JOHN R GRAY II_
Address: _4965 E Red Range Way   CAVE CREEK,AZ 85331
Post Reply