Page 1 of 1

dual field lookup from links

Posted: 2019-08-01 00:01
by jnewtcomp
Hello

I have two fields under consumables that are look up fields from inventory. Both fields cross reference each other. One is a bar-code ITEM field, one is a manufacturing part number field. How can I lookup MFG P/N field or bar-code field and auto fill one or the other from lookup?

Thank you in advance.

Re: dual field lookup from links

Posted: 2019-08-03 13:46
by jnewtcomp
I have two fields i need to populate based on the information placed in one of the two fields.

Consumable_Tools
Item:
MFG_Part_Number:

Both fields are important and need to be cross referable. If I scan a bar code one of two numbers comes up. Item number is often a bar code number and not the part number. The part number is how everyone orders the tools. If i have only the part number and not the item number how do i populate the item number. Hope this makes my question a little more understandable.

there is only one item number per part number and only one MFG_Part_Number per item number.


Thank you!!!!

Jim

Re: dual field lookup from links

Posted: 2019-08-03 14:57
by jsetzer
1) On save you can use TABLENAME_before_insert() function in hooks/TABLENAME.php to get the other value from database and fill $data

2) if you want to read the other value immediately after barcode scan or input, you can use $j.ajax(...) in TABLENAME-dv.js to call a server side php script. Pass the existing value from $j("fieldname1").val() to the server script, in php get missing value from DB, return both values as JSON back to client and put the values into your input fields using $j("#Fieldname1").val(data.value1); for example.

Regards,
Jan

Re: dual field lookup from links

Posted: 2019-08-05 20:17
by jnewtcomp
Thank you for the reply, I would love to say i know what your talking about but that would be a lie. I am learning the hard way by failing over and over. Is there any way to break that down to laymen's terms? I build these computers and support them not program them. :) thank you for all your help