Prudhvi Kumar Chowdary
Posts: 0
Joined: Fri Jul 04, 2014 5:17 am

Problem in calculation input values

hi,
i have a html tab in that there is grid, in this grid i have one row and 6 columns as shown in below fig. this grid are getting values from database, grid ia in loop.
Image

here on changing required number the total price value have to change by multiple of each price * required number

please help me ...............

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Problem in calculation input values

Hi Prudhvi,

Use the following code please:pre$("[name=inputName]").val("*");/preWhere 'inputName' is a name of Input component.

Prudhvi Kumar Chowdary
Posts: 0
Joined: Fri Jul 04, 2014 5:17 am

Problem in calculation input values

hi katya,

check this ones i am using this code in required component value change event javascript action. i'm getting results only to first row, i want to all the remaining rows also
.....
.

Image

.
.
.

var n1 = parseFloat(Appery("req").val()),
n2 = parseFloat(Appery("price").text()),
n3 = parseFloat(Appery("avl").text())
;

if(n1 );
}

check this ones

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Problem in calculation input values

Prudhvi,

Sorry, not sure I understand what the code you posted.
Could you please clarify what fields you want to change and how you generate them (via service mapping or using Builder UI) ?

Prudhvi Kumar Chowdary
Posts: 0
Joined: Fri Jul 04, 2014 5:17 am

Problem in calculation input values

Hi Katya,

here Code, Name , Available and Each Price are generate via service mapping ,

after that now selecting number of Required number as input, based on that calculating the Total Price as Product of Each price and Required,

Total Price = Required * Each Price,

this rows i am getting as iterating loop , i am getthing result only for first row , remains rows are not effecting. as show in above screen,

here my implementation screen,
.
.

i need this calculation for all rows...... Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Problem in calculation input values

Hi Prudhvi,

Use the following code:prevar gridArr = $("[name=gridName]");
gridArr.each(function(){
var required = parseFloat($(this).find("[name=required]").val());
var price = parseFloat($(this).find("[name=price]").val());
var total = required * price;
$(this).find("[name=total]").text(total);
});/preWhere gridName - is a grid name,
required, price - are input components names,
total - is a name of lable 'total'.

Prudhvi Kumar Chowdary
Posts: 0
Joined: Fri Jul 04, 2014 5:17 am

Problem in calculation input values

Hi Katya,
This is Working, thanku, now i need sum off all total Price to Grand total

and sun of all require to total req .. how to add those values . please...........

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Problem in calculation input values

Hi Prudhvi,

Please try this code

codevar gridArr = $("[name=gridName]");
var required, price, total, $this, requiredTotal = 0, priceTotal = 0;
gridArr.each(function(){
$this = $(this);
required = parseFloat($this.find("[name=required]").val());
price = parseFloat($this.find("[name=price]").val());
total = required * price;
$this.find("[name=total]").text(total);
requiredTotal += required;
priceTotal += total;
});
Apperyio("GrandTotalPriceLabelName").text(priceTotal);
Apperyio("GrandRequiredLabelName").text(requiredTotal);/code

Please do not forget to change GrandTotalPriceLabelName and GrandRequiredLabelName to the corresponding names of your labels

Prudhvi Kumar Chowdary
Posts: 0
Joined: Fri Jul 04, 2014 5:17 am

Problem in calculation input values

hi Katya and Evgene

i have 4 items in database, but it looping for 5 times, what to do now please help me

Prudhvi Kumar Chowdary
Posts: 0
Joined: Fri Jul 04, 2014 5:17 am

Problem in calculation input values

Hi Evgene and Katya,
.
Image
.

In the above screen at Header i have amtAvl lable value 150000 , with that lable value i need to subtract GrandTotalPrice , result value have to place at Required value , i try but getting null please help me for this.............

Return to “Issues”