Dear all,
On OnValidate event I’ve inserted this code in order to check if there is jet a record for a user:
If I run the select directly on mysql database the answer is correct : i.e. 0 or 1 or better
COUNT(*)
1
Now I have to make a test if the result of select is >0 .
It seems that non result on echo are displayed (like empty).
Am I wronging something or dataset works in different way on a select count ?
// Check for existing record
$check_sql = ‘SELECT COUNT(*) FROM med_therapy_m WHERE med_therapy_m.user_id = {user_id}’;
sc_lookup(dataset, $check_sql);
{check_flag}={dataset}[0][0];
$check_flag = {check_flag};
echo "CHECK_FLAG “. $check_flag .” DATASET ". {dataset};
if ($check_flag > 0) // Error message
{
sc_error_message('Attenzione esiste gi? una scheda aperta per questo nominativo - Warning: An entry with the same user name exists yet ');
}
Thanks so much
Giovannino