I have one drop-down to select the market
one more drop-down to select the item.
A text field displays the value based on these two selections.
also, a text field to enter Qty.
Another text field for discount.
One more read-only text field displays the final price based on the first text field considering the Qty and the discount.
I need to show the profit as well.
Considering all the above, How do I do that.
Example of the query. (I am no JS expert, Apologies in advance)
If Market is UAE - ECP and Item is Item No1, Profit = Offered Price - (Predefined Value * Qty)
I was thinking of something like below.
var mkt = this.getField("DP2").value;
var dev= this.getField(("Dropdown58").value;
var p1= Text32*1000
if (mkt=="UAE - ECP" && dev=="ZEISS Server") event.value = "text44"-p1
Please help me out. I am clueless.
Copy link to clipboard
This should do what you asked for:
var mkt = this.getField("DP2").valueAsString;
var dev = this.getField("Dropdown58").valueAsString;
var p1 = Number(this.getField("Text32").value)*1000;
var p2 = Number(this.getField("Text44").value);
if(mkt=="UAE - ECP" && dev=="ZEISS Server")
event.value = p2-p1;
event.value = "";
You need to check field calculation order, select 'Prepare form' tool, click on 'More' then on 'Set field calculation order' and move "Text44" above "Text2" so it calculate first.
Yes it worked.