[ic] Using username to search another table - ALMOST

Philip Alves interchange-users@icdevgroup.org
Thu Oct 24 16:43:00 2002


> At 09:17 AM 10/24/02 -0400, you wrote:
> >I'm trying to use username from userdb as the search string for another
> >database.  I'm doing this in an attempt to add multiple shipping
addresses
> >in a seperate database.  Here is the last attempt I've made:
> >
> >[calc]$Config->{NoSearch} = ''[/calc]
> >   [if data shiptos::username::[data session username]]
> [snip]
> >This doesn't work, and I get this error in error.log:
> >
> >192.168.1.250 dXY5WICp:192.168.1.250 - [24/October/2002:21:13:23 -0400]
dev
> >/cgi-bin/dev/process.html Bad if 'data shiptos::username::[data session
> >username': syntax error at (eval 457) line 2, near "q{} session username
> >
> >I've searched the mail archives, but no luck.  Any shove towards the
proper
> >documentation, or any thoughts on what's going wrong would help me a
ton!!!
>
> Quoting from the 'Template Guide', page 14, 1st paragraph:
> "If another tag is needed to select the key, and it is not a looping tag
> construct, named parameters must be used".
> So try
> [if type=data term="shiptos::username::[data session username]"]
> This construct forces interpolation of the inner tag which, in Perl-speak,
> means using qq{} instead of q{}.
> Cheers,
>
> Yves Beaudoin, Ph.D., President,
> Webpraxis Consulting Ltd.,
> Edmonton, Alberta, Canada, T5R 5S5
> E-mail: post@webpraxis.ab.ca
>
> Owner of the Virtual Railroad:
> www.webpraxis.ab.ca/vrr/
>

Ok, I realized my goof-up.  I should've been using [loop-code], which I am
now, and now I get all the choices I should be getting.  My question now is
how do I use this to retrieve all the proper fields for Shipping Address on
checkout.html?  This is the drop-down code:

[calc]$Config->{NoSearch} = ''[/calc]
[if type=data term="shiptos::username::[data session username]"]
<SELECT NAME=shipto onChange="this.form.submit()">
    [loop search="fi=shiptos.txt/st=text/sf=username/se=[data session
username]/op=eq/co=yes/rf=store_number,Name,Address_1,Address_2,Address_3,Ph
one,Fax"]
<option value=[loop-code]>[loop-param store_number]  [loop-param Name]
[/loop]
</select>
[/if]

I would really like to have the page update when the user picks a store from
the drop down, and all the fields would be filled in.  I can't use
[loop-param xxx] because the loop is closed.  I'm experimenting with [if]
but with no success yet.  Any thoughts?

TIA!!!