Copy link to clipboard
Copied
if(text32>601,text32*1,text32*text10)
Please help to convert above mentioned formula in java script
Thanks in anticipation
Why does you multiply with 10?
Copy link to clipboard
Copied
Hi,
Assuming the fieldNames are text32 and text10
then the if would be
var text32Value = this.getField("text32").value;
if ( text32Value <= 601) {
var result = text32Value * 10;
} else {
var result = text32Value;
}
As to what you want to do with result, you would need to explain more about your form? This would probably be best placed on the Validate of text32, as then it is only run if text32 changes.
Regards
Malcolm
Copy link to clipboard
Copied
Why does you multiply with 10?
Copy link to clipboard
Copied
Text10 is the qty and Text 32 is value the logic is if text32 value goes beyond 602 $ it will remain 602 in the total result.
if Text32 is lower then 602 $ it will multiply with qty and give the result as given in image.
Kindly help to provide the script
Thanks in advance.
Copy link to clipboard
Copied
Use this code as the custom calculation script of the field where you want to display the results:
var text32Value = Number(this.getField("text32").valueAsString);
if ( text32Value <= 601) {
event.value = text32Value * 10;
} else {
event.value = text32Value;
}
Copy link to clipboard
Copied
Why do you multiply with 10?
Copy link to clipboard
Copied
Sorry, I just adjusted the code provided before. I see now it should be a field... Will post an updated version shortly.
Copy link to clipboard
Copied
Fixed version:
var text32Value = Number(this.getField("text32").valueAsString);
var text10Value = Number(this.getField("text10").valueAsString);
if (text32Value <= 601) {
event.value = text32Value * text10Value;
} else {
event.value = text32Value;
}
Copy link to clipboard
Copied
Hi Thanks, But still it is not solving the problem
Copy link to clipboard
Copied
You need to provide more information about what goes wrong...
Copy link to clipboard
Copied
post insertion of code in form it is not giving the result as it comes as blank
Copy link to clipboard
Copied
Check the JS Console (Ctrl+J) for error messages.
Copy link to clipboard
Copied
send me your mail ID i will mail you the file as i am completely noob in this
Copy link to clipboard
Copied
[try6767 at gmail.com]
Copy link to clipboard
Copied
Hi Sent
Copy link to clipboard
Copied
Thanks it is solved
Copy link to clipboard
Copied
Text10 is the qty and Text 32 is value the logic is if text32 value goes beyond 602 $ it will remain 602 in the total result.
if Text32 is lower then 602 $ it will multiply with qty and give the result as given in image.
Kindly help to provide the script
Thanks in advance.