Hi,
I’m using the latest version of scriptcase and struggling with what should be a very, very easy task.
On adding a record I have a field who’s value is calculated depending on the first field but I cannot get it to work. The first field (Product Manager) is a dropdown select with an ajax OnChange event. In the onChange event I have this: -
$sql = “Select Isnull(Max(DivGroup),0) as NextDiv From BMG_ProdManagers Where ProdMngr_Id = '”.{Prodmngr_Id}."’";
sc_lookup(dsPM,$sql,“conn_warehouse”);
If({dsPM} == false)
** {**
** echo "SQL Error Message ".{dsCalendar_erro};**
** }**
elseif (Empty(dsPM))
** { **
** $NewDivGroup = 1;**
** }**
else
** {**
** $NewDivGroup = {dsPM[0][0]} + 1;**
** }**
sc_set_focus(‘DivGroup’);
{DivGroup} = IntVal($NewDivGroup);
Basically, this goes an gets the next DivGroup number for the selected Product Manager. The above code executes correctly and calculates the correct value. I have tested it using Echo to see the value that is generated. However, the last line is where I assume I am updating the DivGroup field with the calculated value, but it doesn’t. The DivGroup field, a required field, does not get updated and certainly does not show the calculated value.
What am I doing wrong? This should be a simple task.
TIA