Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
How to realize lookup of two or more data
-
- Posts: 7
- Joined: Tue Apr 05, 2022 10:18 am
How to realize lookup of two or more data
1,What code can I use when I choose cp_Invoice_contact_id
cp_Invoice_customer->Cp_customer_name
cp_Invoice_address->Cp_customer_address
cp_Invoice_phone->Cp_contact_phone
2,What code can I use when I choose cp_Invoice_contact_id
cp_Invoice_date -> today's date
You do not have the required permissions to view the files attached to this post.
Last edited by hujunhong on Tue Apr 05, 2022 6:11 pm, edited 7 times in total.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: How to realize lookup of two or more data
Hi,
You can use PHP in the After Browse event for that Lookup to populate these additional fields.
The function you need is nuSetFormValue
You can use PHP in the After Browse event for that Lookup to populate these additional fields.
The function you need is nuSetFormValue
-
- Posts: 7
- Joined: Tue Apr 05, 2022 10:18 am
Re: How to realize lookup of two or more data
Thank you Kevinkev1n wrote: ↑Tue Apr 05, 2022 1:40 pm Hi,
You can use PHP in the After Browse event for that Lookup to populate these additional fields.
The function you need is nuSetFormValue
2,cp_Invoice_phone_id->Cp_contact_phone
nuSetFormValue('cp_Invoice_phone',nulookupRecord()->Cp_contact_phone);
it is ok
but 3 and 4 cp_Invoice_customer and cp_Invoice_address is not
I tried nuSetFormValue only in the same table, but my information is two tables, how to use code?
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: How to realize lookup of two or more data
Use this JavaScript in the lookup's LUJS field:
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
-
- Posts: 7
- Joined: Tue Apr 05, 2022 10:18 am
Re: How to realize lookup of two or more data
Code: Select all
SELECT
Cp_Invoice.*,
Cp_contact.*,
Cp_customer.*
FROM
Cp_Invoice
JOIN Cp_contact ON Cp_Invoice.cp_Invoice_contact_id = Cp_contact.Cp_contact_id
JOIN Cp_customer ON Cp_contact.Cp_contact_customer_id = Cp_customer.Cp_customer_id
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4297
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: How to realize lookup of two or more data
nuLookupRecord() will only return the the fields of the table used by the Lookup. You can add an additional query to retrieve the other values.
Example:
viewtopic.php?p=15921#p15921
Example:
viewtopic.php?p=15921#p15921
-
- Posts: 7
- Joined: Tue Apr 05, 2022 10:18 am
Re: How to realize lookup of two or more data
thank you kevin.problem solvedkev1n wrote: ↑Tue Apr 05, 2022 6:20 pm nuLookupRecord() will only return the the fields of the table used by the Lookup. You can add an additional query to retrieve the other values.
Example:
viewtopic.php?p=15921#p15921