How to link a field from Table X to a field in a Table Y

Hello there,

I would  like to know is it is possible to link two fields from different tables. For example I have a field called Residential Address in the Address Table that I would like to link to a field called Physical Address in the Delivery Note, how can I achieve that? The same goes for a field Customer ID in the delivery note for example that should be linked to Customer ID in the customer table. I have tried using the link option when creating the custom field but with no success. How can I do that? Some other options?
Your help will be greatly appreciated.

Regards,
Kat



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/92a4e263-8cd3-4e65-9770-20d5342cfd7e%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Kat!

You can add a custom field with type Link, on your DocType, and add in the option field the name of referenced doctype eg:


Address:
Residential_Address => option:Address


2014-03-25 11:54 GMT-03:00 Kat <py...@gmail.com>:
Hello there,

I would like to know is it is possible to link two fields from different tables. For example I have a field called Residential Address in the Address Table that I would like to link to a field called Physical Address in the Delivery Note, how can I achieve that? The same goes for a field Customer ID in the delivery note for example that should be linked to Customer ID in the customer table. I have tried using the link option when creating the custom field but with no success. How can I do that? Some other options?
Your help will be greatly appreciated.

Regards,
Kat



Note:



If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/92a4e263-8cd3-4e65-9770-20d5342cfd7e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CABK1YkPP5pQt%2BdaYBbYsbkWNvFa0bKv4%2B%2B3HeOaQ5gr7bK%2BiuA%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Maxwell,

Thanks, I tried that but it didn't work as expected. Should the two fields have the same name and data type in the two tables? How does the link between those two fields work?

Regards,
Kat

On Tuesday, March 25, 2014 5:55:15 PM UTC+2, Maxwell wrote:
Hi Kat!

You can add a custom field with type Link, on your DocType, and add in the option field the name of referenced doctype eg:


Address:
    Residential_Address => option:Address


2014-03-25 11:54 GMT-03:00 Kat <py...@gmail.com>:
Hello there,

I would  like to know is it is possible to link two fields from different tables. For example I have a field called Residential Address in the Address Table that I would like to link to a field called Physical Address in the Delivery Note, how can I achieve that? The same goes for a field Customer ID in the delivery note for example that should be linked to Customer ID in the customer table. I have tried using the link option when creating the custom field but with no success. How can I do that? Some other options?
Your help will be greatly appreciated.

Regards,
Kat



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/92a4e263-8cd3-4e65-9770-20d5342cfd7e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/762c6739-b753-420e-8d62-ca33dda00d38%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Kat, fields with type Link is the like a "one-to-one reference" in SQL databases, but the name of the field in the Doctype that contains it, can be anything, but in the option the value contained is the name of the referenced Doctype, when frappe resolve the construction of the form, it understant that the field referenced is the field "name" contained on referenced DocType.

Look the image below (and ignore the AddressFacade)

Imagem inline 1

Address have a field named "person", it is a Link with option "Person"

You can understand?


Ps: name is a default field and exists in all doctype, it is created by core, not by you!




2014-03-25 19:40 GMT-03:00 Kat <py…@gmail.com>:

Hi Maxwell,

Thanks, I tried that but it didn't work as expected. Should the two fields have the same name and data type in the two tables? How does the link between those two fields work?


Regards,
Kat



On Tuesday, March 25, 2014 5:55:15 PM UTC+2, Maxwell wrote:

Hi Kat!

You can add a custom field with type Link, on your DocType, and add in the option field the name of referenced doctype eg:


Address:
Residential_Address => option:Address


2014-03-25 11:54 GMT-03:00 Kat <py...@gmail.com>:

Hello there,

I would like to know is it is possible to link two fields from different tables. For example I have a field called Residential Address in the Address Table that I would like to link to a field called Physical Address in the Delivery Note, how can I achieve that? The same goes for a field Customer ID in the delivery note for example that should be linked to Customer ID in the customer table. I have tried using the link option when creating the custom field but with no success. How can I do that? Some other options?
Your help will be greatly appreciated.

Regards,
Kat



Note:



If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/92a4e263-8cd3-4e65-9770-20d5342cfd7e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3



Note:



If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.



    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/762c6739-b753-420e-8d62-ca33dda00d38%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Best Regards.

Maxwell Morais
Python Developer powered by Webnotes framework <3
+55 11 954329659




Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CABK1YkMMgdk8QFJpns3wawTKYvoT7HZXLvLn_39KmdWh1qeSfg%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.