Page 1 of 1

Autofill not working when lookup field is a master field

Posted: Tue Sep 17, 2013 1:30 pm
by lancealot83

Hello I am using phpmaker version 9.2.0 and I have noticed that the auto fill is not functioning when the lookup field of the autofill is also the key field of a master/detail add page.

I think it is because the look up field is just plain text in that situation....

Example:
Master Record: Service Requests

Request ID | 6
Date Received
(dd/mm/yyyy) | 09/11/2005
Completion Status | COM, Complete
Referral

Date Created
(dd/mm/yyyy) |08/02/2013
Date Modified
(dd/mm/yyyy) | 08/02/2013

Section: Projects
Add Delete Selected Records

The Service Request ID is the basis of the auto fill in the projects table, but when the add button is clicked the service request id which is the FK in the Project table is filled in already and is not editable (which is expected), however the Auto fill fields based on this ID are not being filled in.

Is there anyway to make the auto fill work in this scenario?

Thank You


Re: Autofill not working when lookup field is a master field

Posted: Tue Sep 17, 2013 3:08 pm
by mobhar

Since you mention the master/detail, if I am not mistaken, did you want to autofill the key in the Detail section based on the key of the master record?


Re: Autofill not working when lookup field is a master field

Posted: Wed Sep 18, 2013 3:59 am
by lancealot83

I want to have the other fields in the detail table be autofilled which is based on selecting the servicerequestid.


Re: Autofill not working when lookup field is a master field

Posted: Wed Sep 18, 2013 9:28 am
by mobhar

You can refer to the demo project.

From the "orders" menu, you can see its master/detail relationship to the "orderdetails" table. After you click on "Add order/orderdetails" button, then you can see in the "Detail" section, when you are selecting the "Product ID", the "Unit Price" column will be auto-filled in based on the selected Product ID.


Re: Autofill not working when lookup field is a master field

Posted: Wed Sep 18, 2013 10:34 am
by danielc

Autofill does not work if you use foreign key as the the link field since foreign key is not editable. So, it will not trigger to fill your target.

You need to use Row_Inserting server event to get the value from other table to fill your value.


Re: Autofill not working when lookup field is a master field

Posted: Thu Sep 19, 2013 2:08 am
by lancealot83

Ok thanks, danielc I will try doing it in the Row_Insetring event or the Row_selected event.