8.9. Using more than one table

You can save/retrieve userdb information from more than one table with the outboard specifier. It is a quoted key-value comma-separated series of field specifications. For instance, if the billing address is to be stored in a separate table named "billing", you would do:

        UserDB  default outboard  <<EOF
            "b_fname=billing::first_name,
             b_lname=billing::last_name,
             b_address1=billing::address1,
             b_address2=billing::address2,
                         b_etc=billing::etc"
        EOF

When the user logs in, Interchange will access the first_name field in table billing to get the value of b_fname. When the values are saved, it will be saved there as well. If you wish to make the fields read-only, just set UserDB default scratch "b_fname b_lname ..." and the values will be retrieved/saved from there. To initialize the values for a form, you could do a function after the user logs in:

 [calc]
        my @s_fields = grep /\S/, split /[\s,\0]+/, $Config->{UserDB}{scratch};
        for(@s_fields) {
                $Values->{$_} = $Scratch->{$_};
        }
        return;
 [/calc]

If the fields in the outboard table use another key besides username, you can specify the column in the userdb that contains the key value:

        UserDB  default  outboard_key_col   account_id