How I can modify list element numeric value since one repeat group field element value?

In others words, I need multiply one numeric value (repeat group) with numeric records in another list.

Example: 2 * 5 = 10

Form 1
2 (record I put in repeat group)

List 2
5 (record saved in repeat group)

Final Result:
List 2
10

I found one js about it, but it only works with elements in the same repeat group:

var t= 0;
$('group2').getElements('.fabrikSubGroup').each(function(subgroup){
var v = subgroup.getElement('input[id^=tablename___value]');
var a = subgroup.getElement('input[id^=tablename___amount]');
t += (v.getValue().toInt() * a.getValue().toInt());
});
alert('total = ' + t);

Thanks
 
First question, how do you want to handle repeats? So if say form 1 has 3 repeats ...

Form 1
2, 3, 4

... list 2 has 4 repeats ...

List 2
5, 6, 7, 8

... what results are you expecting?

Second issue ... you can't access the data from list 2 on form 1, as they are not related, the data just isn't there. So this would have to be done on the server side, with custom code.

Are you trying to display the results in "real time" on the page for Form 1?

Or do you just need to update List 2 when Form 1 is submitted?

It might help me understand your requirements better if you actually describe the requirements, rather than using generic "form 1 and list 2", like
"I have an order form with a repeat group with a repeat group of the number of widgets being purchased, and a list with pricing for widgets ..." or whatever.

-- hugh
 
I have 2 lists:

1. fab_ordenes_pedido = > Group 11: DETALLES DEL PEDIDO (repeat group)
2. insumos_linea_modelos => Group 18: INSUMOS A USAR (repeat group)

I need that total values I put in element fab_ordenes_pedido_11____cantidad from repeat group 11 (DETALLES DEL PEDIDO) calc values in insumos_linea_modelos_18_repeat_cantidad:

fab_ordenes_pedido_11____cantidad * insumos_linea_modelos_18_repeat_cantidad

This operation must saved in insumos_linea_modelos_18_repeat_cantidad_total


calc_repeat_groups1.gif


List INSUMOS POR LINEA DE MODELOS (insumos_linea_modelos) is inserted into form ORDENES DE PEDIDO:

list_into_form.gif

Finally, this is the detail view I need to print:

detail_view3.gif


Thansk for you support
 
OK, so how do you know which row in the insumos_linea_modelos_18_repeat_cantidad_total group is related to which fab_ordenes_pedido_11____cantidad group total?

-- hugh
 
The idea is to obtain the result of the multiplication of fab_ordenes_pedido_11____cantidad and insumos_linea_modelos_18_repeat_cantidad. In this case, there is not relation row by row.

The sum of all values in fab_ordenes_pedido_11_repeat____cantidad is multiply with all records in insumos_linea_modelos_18_repeat_cantidad.

For example:
fab_ordenes_pedido_11_repeat____cantidad[1] = 3
fab_ordenes_pedido_11_repeat____cantidad[2] = 2
fab_ordenes_pedido_11_repeat____cantidad[2] = 4
Total Sum = 9

Finally:
9 * insumos_linea_modelos_18_repeat_cantidad

If in insumos_linea_modelos_18_repeat_cantidad there are values 0.20 and 0.55, the calc is:
9 * 0.20
9 * 0.55

The result is saved in insumos_linea_modelos_18_repeat_cantidad_total.
 
I'll have to come up with some custom code for you.

The way this kind of support works is that we first have to identify the problem, and make sure we understand exactly what solution you need. That process falls in the "24 hour response" for Pro support. If the solution involve writing custom code, we have to figure if it falls within the "Giving small code samples for specific situations" we offer for Pro support. That process sometimes takes a few days, as I have to find time to look at the very specific details of your setup. If we don't think it falls within the "small code samples" scope, we then have to figure out how long we think it'll take, so we can quote you for the billable work.

In this case, you need a form PHP plugin, which will have to read and write data from/to the database. It may well be more than "small code sample".

I'll try and have something for you by the end of today, either some code for you to try, or a quote for doing it.

-- hugh
 
I just tried to start work on it, but the imsac site gives me:

Error displaying the error page: Application Instantiation Error: Could not connect to MySQL.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top