Nested Loops in HPOO? (250 Views)
Reply
Occasional Collector
MoofuJJ
Posts: 1
Registered: ‎05-08-2014
Message 1 of 2 (250 Views)

Nested Loops in HPOO?

Hi all,

 

Im trying to implement a simple nested loop within HPOO and im running into some problems. Basically the pseudo code im trying to recreate in HPOO is:

 

for( int j = 0; j < 5; j++ )

{

      for( int i = 0; i < 10; i++ )

      {

                      AddEmail( i + j * 10 ); Send();

      }

}

 

Ther only problem im having is when i try to do mathmateical operations on flow variables. So, for example, im using Counters, and the resultText of Counters are strings. However when i parseint them, it adds on decimal places which i cant seem to get rid of, and so i am unable to use the resulting integer.

 

Has anyone made a nested loop in HPOO?

Trusted Contributor
Steve_Drummond
Posts: 89
Registered: ‎10-01-2012
Message 2 of 2 (215 Views)

Re: Nested Loops in HPOO?

[ Edited ]

You can't use the mathematics HPOO operations within the HPOO loop (../util/math and comparison/multiply)?

 

if you need to do it within the scriptlet

 

try {
  var myNumber = parseInt(counter); // where counter is your 'number' string
  myNumber = myNumber.toFixed(0); //remove the decimal place, rounds the number
} catch (e) {
  // error handling
}

 

see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.