sc_master_value() really strange problem

Hi, I have a Master/Detail application, and I created an PHP Method called update_master (like scriptcase samples).

sc_lookup(dataset,“SELECT SUM(cantidad*precio_unitario) FROM tmp_facturas_detalles WHERE id_factura = ‘{id_factura}’”);

sc_lookup(datos_iva,“SELECT valor FROM tb_configuracion WHERE nombre = ‘iva’”);

if(empty({dataset}))
{
sc_error_message(‘El accesorio especificado no tiene precio de venta asignado’);
}
else
{
$base_imponible = {dataset[0][0]};
$imponible = number_format($base_imponible, 2,’,’,’.’);

$porcentaje = rtrim({datos_iva[0][0]});
$porcentaje_modificado = “1.”.$porcentaje;

$montoTotal = $base_imponible * $porcentaje_modificado;
$montoTotal2 = number_format($montoTotal,2,’,’,’.’);

$montoIva = $montoTotal - $base_imponible;
$montoIva2 = number_format($montoIva,2,’,’,’.’);

$iva_sql = number_format($montoIva,2,’.’,’’);
$total_sql = number_format($montoTotal,2,’.’,’’);

sc_master_value(‘base_imponible’,$imponible);
sc_master_value(‘iva_monto’,$montoIva2);
sc_master_value(‘monto_total’,$montoTotal2);

sc_exec_sql(“UPDATE tmp_facturas SET base_imponible = “.$base_imponible.”, iva_monto = “.$iva_sql.”, iva_porcentaje = '”.$porcentaje."’, monto_total = “.$total_sql.” WHERE id = ‘".{id_factura}."’");
}

The problem is when I call the method in onAfterInsert Event (or whatever else), the code as written before works fine, but sc_master_value doesnt work and the values in the master form are not updated.

BUT if I call a non-declared variable the values in master form are updated, I mean, by example, If before sc_exec_sql() (or anywhere in the method) I write echo $anything, Master Form values are updated but (of course) I receive an error in the application and stops its execution.

Do I explain my problem well? if not please tell me in order to try to explain better, I do not speak english.

Thanks a lot (y)

Re: sc_master_value() really strange problem

Problem solved automagically with the new SC5 update…

Re: sc_master_value() really strange problem

Some clarifications please

When I go to samples - Master Details Form
and want to learn from the tutorial

the information given is not exactly the same as that given with the training samples in SC version 5

I am a bit confused and do not know which one is BEST To IMPLEMENT FROM

the training samples works fine only when I use it inside the training project
when I try to use it for my own project it does not work. The master file does not update .
The details only updates

here is the code for the method update_master

sc_lookup(dataset,“SELECT
SUM(TotalPrice)
FROM
order_details
WHERE OrderID = {OrderID}”);

if({dataset[0][0]} >= 0)
{

$total = {dataset[0][0]};
$tca = $total *.10;

sc_master_value(‘PriceOrder’, $total);
sc_master_value(‘Taxes’, $tca);
sc_master_value(‘TotalFacture’,PriceOrder + Taxes);

$total = number_format({dataset[0][0]}, 2, ‘.’, ‘,’);
sc_exec_sql(“UPDATE orders SET PriceOrder = $total,
Taxes = $tca,
TotalFacture = PriceOrder + $Tca
WHERE OrderID = {OrderID}”);

}

Re: sc_master_value() really strange problem

hi there just checking this line:
$tca = $total *.10;

this does not seem correct. Should this not be:
$tca = $total * 10;

Hope this helps
George