[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4586: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4588: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4589: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4590: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
Xataface Forums • View topic - Autopopulate fields based on lookup on another table

Autopopulate fields based on lookup on another table

A place for users and developers of the Xataface to discuss and receive support.

Autopopulate fields based on lookup on another table

Postby rleyba » Tue Feb 12, 2013 4:33 am

Hi Steve,
I just need some assistance crafting an afterinsert trigger on the form I'm designing.

One of the fields in the form is DEVICE_NAME. The form also contains other fields like LOCATION, VENDOR, IP_ADDRESS and SERIALNUM, etc. I already have another table in the same xataface application called INVENTORY, which has among its fields, DEVICE_NAME, IP_ADDRESS, SERIALNUM (and there is one-to-one correspondence among these fields).

My intent is that once I fill up the form and the user keys in the DEVICE_NAME, when the record is saved, xataface will do a lookup of the IP_ADDRESS and SERIALNUM from the INVENTORY table based on the DEVICE_NAME entered by the user, then just auto-populate these two fields in the form. If there is no match, I would like some generic message like UNKNOWN to be keyed in in IP_ADDRESS and SERIALNUM.


Thanks very much.
rleyba
 
Posts: 53
Joined: Sat Dec 04, 2010 3:50 pm

Re: Autopopulate fields based on lookup on another table

Postby shannah » Tue Feb 12, 2013 10:23 am

Sounds like you have it figured out. What exactly are you stuck on?
--
Steve Hannah
(on twitter)
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Autopopulate fields based on lookup on another table

Postby rleyba » Wed Feb 13, 2013 3:42 am

rleyba
 
Posts: 53
Joined: Sat Dec 04, 2010 3:50 pm

Re: Autopopulate fields based on lookup on another table

Postby auphi » Wed Feb 13, 2013 8:43 am

auphi
 
Posts: 20
Joined: Sun Oct 21, 2012 7:39 pm

Re: Autopopulate fields based on lookup on another table

Postby rleyba » Thu Feb 14, 2013 5:20 am

rleyba
 
Posts: 53
Joined: Sat Dec 04, 2010 3:50 pm

Re: Autopopulate fields based on lookup on another table

Postby rleyba » Thu Feb 14, 2013 7:02 am

rleyba
 
Posts: 53
Joined: Sat Dec 04, 2010 3:50 pm

Re: Autopopulate fields based on lookup on another table

Postby auphi » Thu Feb 14, 2013 7:34 am

Sorry about the syntax error; I freehanded the code, and apparently didn't error check myself, but you are correct they should be () not [].

Couple of quick things: echo won't work with record objects (the variables $record/$rec) by themselves b/c they are arrays, but you can do "print_r($record->vals())" to show the contents of your record (just learned that myself, thanks Steve). You can however use an echo if you specify the field, i.e. "echo $record->val('DEVICE_NAME')".

I noticed that your line: $rec = df_get_record('INVENTORY', array('DEVICE_NAME'=>$record->val('DEVICE_NAME))); has a syntax error, needing a ' after DEVICE_NAME. So try that. If that's not what's causing the problem, do an "echo $record->val('DEVICE_NAME')" or "print_r($record->vals())" to see what's showing up.
auphi
 
Posts: 20
Joined: Sun Oct 21, 2012 7:39 pm

Re: Autopopulate fields based on lookup on another table

Postby rleyba » Thu Feb 14, 2013 3:41 pm

rleyba
 
Posts: 53
Joined: Sat Dec 04, 2010 3:50 pm

Re: Autopopulate fields based on lookup on another table

Postby auphi » Thu Feb 14, 2013 4:17 pm

auphi
 
Posts: 20
Joined: Sun Oct 21, 2012 7:39 pm

Re: Autopopulate fields based on lookup on another table

Postby rleyba » Fri Feb 15, 2013 6:20 am

rleyba
 
Posts: 53
Joined: Sat Dec 04, 2010 3:50 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved