This topic is locked
[SOLVED]

 add data and copy to field other other table

8/22/2018 11:05:03 AM
PHPRunner General questions
S
shoppy author

I have a project with two Tables.

In table 'Overzicht' I plan new apointments.

In that Table we also put a date for that apointement.

That field is called 'Date'
In the other Tabel 'Clients' we keep the information of the clients.

That table has also a field called 'Date' and we like to update this field 'Date' with the input from 'Date' in 'Overzicht'.

Why? In that case we we can see in the list witch client has been visited last and who needs to be visited first.
This is what we made so far but it doesn't do the trick.

Got it from // Zie: https://xlinesoft.com/phprunner/docs/update.htm
In ADD in "Overzicht" we made an 'Before record added' event that looks like



global $dal;
$tblClients = $dal->Table("Clients");
$tblClients->Param["ClientsID"] = $values['AgendaID'];

$tblLezingen->Value["Date"] = $values['Date'];

$tblLezingen->Update();
return true;


I need some help here

S
shoppy author 8/22/2018

Solved !!
The problem was that the ClientsID not known was in the Apointment table
And then the code needed a small change



global $dal;
$tblClients = $dal->Table("Clients");
$tblClients->Param["ClientsID"] = $values['ClientsID'];

$tblLezingen->Value["Date"] = $values['Date'];

$tblLezingen->Update();
return true;
S
shoppy author 10/16/2018

This works for the "Before record added" but not for the "Before record update" on the Edit page.
Why not?
Suppose you need to change a date for a upcoming appointment, because the customer changed the date.

It would be nice if the change the date in "Overzicht" this new date will overwrite the date in Client.

S
shoppy author 10/16/2018



This works for the "Before record added" but not for the "Before record update" on the Edit page.
Why not?
Suppose you need to change a date for a upcoming appointment, because the customer changed the date.

It would be nice if the change the date in "Overzicht" this new date will overwrite the date in Client.


Solved!
The line should be in "After record updated", thats all.