On theAdd Page for a form I have a field called "distance_factor" which is written as a numeric 1 or 2 value to the "distance_factor" field in table "reporting_a"
Another value which is inputted in this form is "doctor_id" which is the primary id in table "doctors_a".
I use the Lookup Wizard to query table "distance_factor" for two records as lookups: primary id 1 equals text value "less than 30 km", primary id 2 equals text value "more than 30". So that on the Add page form the user sees a dropdown list to choose "less than 30 km" or "more than 30 km"... the submitted value for "distance_factor" will be 1 or 2.
Want ONE:
What I want to do is to not only write that 1 or 2 value into the "distance_factor" field in table "reporting_a" when the form is submitted, but, to simultaneously write that numeric value into the Doctor's Record whose "doctor_id" (unique) matches the "doctor_id" value submitted when this form was written to table "reporting_a". I have hundreds of Doctor's records which have a "distance_factor" field waiting for this same value and no records in the "doctors_a" table have this yet.
I would like to kill those two birds with one stone here, obviously. I have looked at the information in the manual about writing to two tables at the same time and see that this should be dropped into the Add page Events at the proper stage.
Second Want if I can achieve Want ONE:
I have a situation where if the doctors table view is opened first and a specific doctor's "reporting" link is clicked to go to the "reporting" view, if I THEN hit the ADD Report button, the form pops up with the Doctor's name(id) already filled in. In this case I would like the doctor's record matching that doctor_id value to be checked as the form is being generated to see if the "distance_factor" field is already filled in. If so, retrieve the 1 or 2 value as the hidden value in the matching field in this form, but with the text value to read, and eliminate writing the lookup wizard dropdown.
In the other situation where the report is started "cold" from the Reporting View, when the Doctor Id is picked from the Dropdown list values for that field I would like the ajax query to immediately check the same doctor's record for the field "distance_factor" value, and if there, retrieve it for writing in the form, and if not, the lookup wizard continues to provide the dropdown list.
Does PHPRunner have existing functionality for me to come up with these on-the-fly solutions?
See, I don't ask for MUCH <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=16192&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' /> !
thanks for any help!