Doing Standard Math Calculations - NOT CAPTCHA RELATED

  • Автор темы Автор темы genetrader
  • Дата начала Дата начала

genetrader

Client
Регистрация
31.03.2011
Сообщения
26
Реакции
0
Баллы
1
Newbie question here... I am trying to divide 1 variable by another or a fixed number.. for example, I am using the Take DOM command to scrape the total number of results off of a page and put that # into a variable called ResultCount. I then know that there are 25 results per page, so I want to create a counter from ResultCount by dividing ResultCount by 25 and looping the pages to scrape by the rounded up results # (for example there are 140 results so 140 / 25 = 5.6 rounded up to 6. So we need to run the scraper for 6 loops...

I am having difficulty how or where standard mathematic calculations are done ... such as resolving simple X - Y, X + Y, X / Y, and X * Y when working with scraped values... Is there a different way to treat text or numeric variables as I have not seen where this would be controlled...

Im sorry but I have searched all videos and this forum for these simple calculation answers and cant find. I great appreciate any and all help provided! Thanks

All the best,

Gene
 
3ab4faf5271750ddc03a4df688d4327e.png


And you can put in Javascript code:

{-Variable.one}+{-Variable.two-}
{-Variable.one}-{-Variable.two-}
{-Variable.one}*{-Variable.two-}
{-Variable.one}/{-Variable.two-}
 
THANKS FOR THE PROMPT RESPONSE!! Now - I am scraping a number that is in TEXT on the page that says "141 Results". I am able to get the # and put it to a variable but when I used your JS formula layout it didnt work. Do I somehow need to format the variable to tell it that it is numeric? I am using DOM... should I use a different element to GET DATA?
 
You can operate that kind of calculations only if you have numbers in your variables.

So make sure you scrape data and prepare it with regex so you will have only numbers to use )
 
DISREGARD - I had accidentally modified my REGEX! THIS WORK - THANKS Rostonix!

One more question - how do I get the value to ROUND UP? It comes out 5.64... Thanks!
 
Math.round({-Variable.yourvariable-})
 
Awesome! :))) Where can I learn about built in math functions?
 
it's javascript action
you can paste any js code there
 
Ok, i'll look into js math functions. But a quick question regarding rounding up variables, how do I round up e.g. this value 5.678938 to this 5.68?
 
5.678938.toFixed(2);
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)