[ic] Using username to search another table

Philip Alves interchange-users@icdevgroup.org
Thu Oct 24 12:32:00 2002


From: "Webpraxis Consulting Ltd." <webpraxs@tnc.ab.ca>

> 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/
>

Thanks for the shove in the right direction!  The error no longer exists,
and in fact I am able to get info out of my "shipto" database using
username.

However, an new problem presents itself.  In my shipto database, there are
multiple addresses for each username.  I've been trying to get these
addresses to appear in the same way as the information in specs.txt is
returned.  So, this is what I've done:

[calc]$Config->{NoSearch} = ''[/calc]
[if type=data term="shiptos::username::[data session username]"]
    [loop search="fi=shiptos/st=db/sf=username/se=[data session
username]/co=yes/rf=store_number,Name"]
       [list]
         [loop-param store_number]:
         [loop-param Name]
       [/list]
    [/loop]
[else]
Nothing to show!
[/else]
[/if]


This, however, only returns the last entry in shipto with that username.
I'm trying to work my way through this, with the hope of eventually creating
a select box with the users various shipping addresses.  Along these lines,
I've done this...

<SELECT NAME=shipto>
    [loop search="fi=shiptos/st=db/sf=username/se=[data session
username]/co=yes/rf=store_number,Name"]
<option value=[loop-param store_number]>[loop-param store_number]
[/loop]
</select>

...and gotten the same result.  Only the last entry shows up, instead of
listing all the entries.  What am I not getting?  I've tried other
combinations and permutations, but all with even less luck.

Again, thanks for all the help!

Phil