Hi,
I would to save data from a form field to a Database., but only if already don't exist a table with the same data. The form field should collect data of patient of a medical research... like this:
Patient code
Age
Gender
Instruction
and others
the control should be on the "Patient code" form field value... How can I do the "setup"?
Thank you
I would to save data from a form field to a Database., but only if already don't exist a table with the same data. The form field should collect data of patient of a medical research... like this:
Patient code
Age
Gender
Instruction
and others
the control should be on the "Patient code" form field value... How can I do the "setup"?
Thank you
Hi Vmad,
It depends a bit on what 'the same data' means. I think that you'd need to use a Custom Code action to check if the data already exists and then use an Event Switcher action (in the Validation group) to either save or not.
Bob
It depends a bit on what 'the same data' means. I think that you'd need to use a Custom Code action to check if the data already exists and then use an Event Switcher action (in the Validation group) to either save or not.
Bob
Hi Bob, Thank you for the advice. I already solve the problem, as you say ,using Event Switcher.
Vmad
Vmad
I have the same problem, but i don't understand how to use event switcher.
I have loaded data with DB reard and then into code tab of Event switch i write this:
where $form->data['EMAIL'] is the array of database data and $form->data['email'] is the value of form field.
Into Events field of Event Switch I have this of default:
In On Success i have a message that the value exist in database.
In On fail i have DB SAVE.
it's SAVE every time😟
Why????
I have loaded data with DB reard and then into code tab of Event switch i write this:
<?php
$verifica=$form->data['EMAIL'];
foreach ($verifica as $ver){
if($ver['email'] == $form->data['email']):
return 'success';
break;
else:
return 'fail';
endif;
}
?>
where $form->data['EMAIL'] is the array of database data and $form->data['email'] is the value of form field.
Into Events field of Event Switch I have this of default:
success,fail
In On Success i have a message that the value exist in database.
In On fail i have DB SAVE.
it's SAVE every time😟
Why????
Hi pierpari,
Your code looks OK. The next step is for you to add some debugger code so that you can see exactly what is happening.
Bob
Your code looks OK. The next step is for you to add some debugger code so that you can see exactly what is happening.
Bob
This topic is locked and no more replies can be posted.