This topic is locked
[SOLVED]

 Automatically assign colum value using Before Record Added event

5/1/2020 3:27:20 PM
PHPRunner General questions
A
abhijit2020 author

Hi!
I have a list page on a table, LeaveRequest and I am trying to insert automatically a value into a column (LeaveRequest.Approver) based on the userid in the list page(inline Add). The value comes from another table, Employee based on the userid. User do not see the column(Approver) in the list page. I have added the following code in the "Before Record Added" event in the add page, but it's giving error when try to insert the record in the list page.
*
$rs = DB::Query('SELECT FROM Employee WHERE EmpNo=:session.userid');
$values["Approver"] = $rs->value("ReportingMgr");
return true;

Any help would be highly appreciated.
Thank you,
Abhi

Sergey Kornilov admin 5/1/2020

You need to see how to work with data returned by DB:Query() function in PHPRunner manual:

https://xlinesoft.com/phprunner/docs/db_query.htm

A
abhijit2020 author 5/3/2020



You need to see how to work with data returned by DB:Query() function in PHPRunner manual:

https://xlinesoft.com/phprunner/docs/db_query.htm



Thank you, Sergey. My issue is resolved...Abhi