On 7 July 2011 14:28, Selvam T, Palani <palani.selv...@altisource.com> wrote:
> Hi,
>  In a simple debug sampler, I used this --> ${__javaScript( eval 
> ('${cpi}'.concat('+'\,'${cti}'\,'+'\,'${eshortage}'\,' /60' )  ) )}

If the variables are all numeric, there is no need to enclose them in
quotes or use eval. Try the following:

${__javaScript(${cpi}+${cti}+(${eshortage}/60))}

>
> It is working.. But not working, if I put it in my script for business case. 
> What could be the problem? In jmeter.log, I got following error..
>
> 2011/07/07 17:30:30 ERROR - jmeter.functions.JavaScript: Error processing 
> Javascript org.mozilla.javascript.EcmaError: SyntaxError: missing ; before 
> statement (<cmd>#1(eval)#1)

That is often caused by trailing spaces in the script.

>        at 
> org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
>        at 
> org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:78)
>        at org.mozilla.javascript.Parser.addError(Parser.java:126)
>        at org.mozilla.javascript.Parser.reportError(Parser.java:132)
>        at org.mozilla.javascript.Parser.statementHelper(Parser.java:1175)
>        at org.mozilla.javascript.Parser.statement(Parser.java:623)
>        at org.mozilla.javascript.Parser.parse(Parser.java:355)
>        at org.mozilla.javascript.Parser.parse(Parser.java:293)
>
> Any suggestion?
>
> Thanks & Regards,
> Palani Selvam
>
> -----Original Message-----
> From: Selvam T, Palani
> Sent: Thursday, July 07, 2011 1:09 PM
> To: JMeter Users List
> Subject: Calculations in JMeter
>
> Hi,
>
>  I need to do a below calculation and should apply for another request.
>
> Formula è pitia=${cpi}+${cti}+(${eshortage}/60)
>
>
>
> I tried eval and javascript, but I didn't get the correct result..
>
> ${__eval('${cpi}'+'${cti}'+'${eshortage}'/60)}
>
> ${__javaScript('${cpi}'+'${cti}'+'${eshortage}'/60)
>
>
>
> Anybody correct the expression?
>
>
>
> Thanks & Regards,
>
> Palani Selvam
>
>
>
>
>
>
> *******************************************************************************************************
>
> This E-mail message and its attachments, if any are intended solely for the 
> use of the addressee hereof. In addition, this message and the attachments, 
> if any may contain information that is confidential, privileged and exempt 
> from disclosure under applicable law. If you are not the intended recipient 
> of this message, you are prohibited from reading, disclosing, reproducing, 
> distributing, disseminating or otherwise using this transmission.
>
>
> Delivery of this message to any person other than the intended recipient is 
> not intended to waive any right or privilege. If you have received this 
> message in error, please promptly notify the sender by reply E-mail and 
> immediately delete this message from your system.  Instructions transmitted 
> over this system are not binding on us until they are confirmed by us. 
> Message transmission is not guaranteed to be secure or free of software 
> virus. While Altisource Portfolio Solutions and its subsidiaries collectively 
> "Altisource" takes every reasonable precaution to minimize such risks, 
> Altisource cannot accept liability for any damage sustained by you or any 
> third party as a result of software viruses.
>
> *******************************************************************************************************
>
>
>
>
> *******************************************************************************************************
>
> This E-mail message and its attachments, if any are intended solely for the 
> use of the addressee hereof. In addition, this message and the attachments, 
> if any may contain information that is confidential, privileged and exempt 
> from disclosure under applicable law. If you are not the intended recipient 
> of this message, you are prohibited from reading, disclosing, reproducing, 
> distributing, disseminating or otherwise using this transmission.
>
>
> Delivery of this message to any person other than the intended recipient is 
> not intended to waive any right or privilege. If you have received this 
> message in error, please promptly notify the sender by reply E-mail and 
> immediately delete this message from your system.  Instructions transmitted 
> over this system are not binding on us until they are confirmed by us. 
> Message transmission is not guaranteed to be secure or free of software 
> virus. While Altisource Portfolio Solutions and its subsidiaries collectively 
> "Altisource" takes every reasonable precaution to minimize such risks, 
> Altisource cannot accept liability for any damage sustained by you or any 
> third party as a result of software viruses.
>
> *******************************************************************************************************
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org

Reply via email to