Greater Than problem in Eval

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Greater Than problem in Eval

by bigdonk22 on Thu Jul 06, 2017 3:39 pm

I don't know if I am crazy or not, but I am having a serious issue with greater than that I have never had before...

Windows 7 64 bit
Chrome 59.0.3071.115 64 bit
iMacors 8.4.4

Code: Select all
SET !VAR1 100
SET !VAR2 60
SET !VAR4 EVAL ("var c = '{{!VAR1}}'; var t = '{{!VAR2}}'; if (c>t) 'YES'; else 'NO';")


This returns a NO instead of yes. If I change the value to 99 it says YES. Again if I do 10>6 I get NO and 9>6 I get YES. It seems to have an issue unless it has the same number of digits in the comparison.

Do I have a setting messed up or something???
bigdonk22
 
Posts: 8
Joined: Thu Nov 03, 2016 9:49 am

Re: Greater Than problem in Eval

by chivracq on Thu Jul 06, 2017 4:44 pm

bigdonk22 wrote:I don't know if I am crazy or not, but I am having a serious issue with greater than that I have never had before...

Code: Select all
Windows 7 64 bit
Chrome 59.0.3071.115 64 bit
iMacors 8.4.4


Code: Select all
SET !VAR1 100
SET !VAR2 60
SET !VAR4 EVAL ("var c = '{{!VAR1}}'; var t = '{{!VAR2}}'; if (c>t) 'YES'; else 'NO';")


This returns a NO instead of yes. If I change the value to 99 it says YES. Again if I do 10>6 I get NO and 9>6 I get YES. It seems to have an issue unless it has the same number of digits in the comparison.

Do I have a setting messed up or something???

Yep, Vars are often treated like Strings by iMacros in 'EVAL()' Statements, you need to make sure to convert your Vars to Numbers or your Comparison will be done Alphabetically instead of Arithmetically...

If your 'if else' Syntax is correct (I didn't know it), try this:
Code: Select all
SET !VAR1 100
SET !VAR2 60
SET !VAR4 EVAL ("var c = '{{!VAR1}}'; var t = '{{!VAR2}}'; if ((c*1)>(t*1)) 'YES'; else 'NO';")
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Greater Than problem in Eval

by bigdonk22 on Thu Jul 06, 2017 5:26 pm

Wow, I never knew that. Thanks for the help...worked like a charm.
bigdonk22
 
Posts: 8
Joined: Thu Nov 03, 2016 9:49 am

Re: Greater Than problem in Eval

by chivracq on Thu Jul 06, 2017 7:16 pm

bigdonk22 wrote:Wow, I never knew that. Thanks for the help...worked like a charm.

OK, good to hear... :D

The 'ADD' Command is not "immune" either, you often end up with "10060" instead of "160" like you would expect for 100+60...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6473
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to General Support & Discussions

Who is online

Users browsing this forum: No registered users and 7 guests

-->