[ic] Not able to retrieve fields from custom table

Tim Good tim.g at edsd.com
Wed May 12 17:06:30 EDT 2004


> -----Original Message-----
> From: interchange-users-bounces at icdevgroup.org 
> [mailto:interchange-users-bounces at icdevgroup.org] On Behalf 
> Of John Rennie
> Sent: Wednesday, May 12, 2004 2:44 PM
> To: interchange-users at icdevgroup.org
> Subject: RE: [ic] Not able to retrieve fields from custom table
> 
> 
> > Tim Good [draco at edsd.com] wrote:
> > >> -----Original Message-----
> > >> From: interchange-users-bounces at icdevgroup.org
> > >> [mailto:interchange-users-bounces at icdevgroup.org] On
> > Behalf Of John
> > >> Rennie
> > >> Sent: Wednesday, May 12, 2004 12:06 PM
> > >> To: interchange-users at icdevgroup.org
> > >> Subject: RE: [ic] Not able to retrieve fields from custom table
> > >>
> > >>
> > >>> -----Original Message-----
> > >>> From: interchange-users-bounces at icdevgroup.org
> > >>> [mailto:interchange-users-bounces at icdevgroup.org] On
> > Behalf Of Tim
> > >>> Good
> > >>> Sent: 12 May 2004 18:35
> > >>> To: interchange-users at icdevgroup.org
> > >>> Subject: [ic] Not able to retrieve fields from custom table
> > >>>
> > >>>
> > >>> Hello list,
> > >>>
> > >>> First sorry for the double post previously, I was not sure which
> > >>> email address was setup. I did not get a response to my 
> > first post
> > >>> so I am reposting with a more specific question.
> > >>>
> > >>> Why would this code not work?
> > >>>
> > >>> [perl table='delivery_schedule']
> > >>>   $Tag->data("delivery_schedule", "charge", "[loop-data
> > transactions
> > >>> order_number]"); [/perl]
> > >>>
> > >>> (mysql 3.23.58 on Redhat 8.0 non threaded perl 5.8.2
> > interchange 5.2
> > >>> stable)
> > >>>
> > >>> All help is much appreciated.
> > >>>
> > >>> Tim
> > >>
> > >> Hi Tim,
> > >>
> > >> You don't say exactly what 'not work' means, so this is 
> a guess...
> > >>
> > >>> From the interchange rtfm tags reference, perl tags are not
> > >>> interpolated
> > >> by default. So
> > >> [perl table='delivery_schedule' interpolate=1]
> > >>   $Tag->data("delivery_schedule", "charge", "[loop-data
> > transactions
> > >> order_number]"); [/perl]  should work better.
> > >>
> > >> You might also want to switch to single quotes within your
> > perl, to
> > >> avoid the risk of any interpolation (e.g. \n or $) of your data
> > >> (unlikely with an order number, but you may have an odd format).
> > >>
> > >> Best regards,
> > >>
> > >> John.
> > >>
> > >
> > > John,
> > >
> > > Thank you for the response and thanks for the advice on
> > using single
> > > quotes. What does not work is that it returns nothing. If I
> > don't use
> > > the interpolate=1 and change the tag to: [perl
> > > table='delivery_schedule' interpolate=1]
> > >    $Tag->data("transactions", "order_number", "[loop-data 
> > transactions
> > > order_number]"); [/perl] I get something returned. To 
> clarify, I use 
> > > "transactions","order_number" just to test the results and use of 
> > > the tag. The interpolate is not necessary, at least in the test 
> > > above. I think, according to my
> > research/reading of
> > > documentation,
> > > it does not work because of something to do with 
> delivery_schedule 
> > > table being a custom table and the data tag wants to work with 
> > > product tables or transaction tables? Just a stab at what 
> I can see 
> > > so far.
> > >
> > > Any ideas?
> > >
> > > Thanks,
> > >
> > > Tim
> > 
> Paul Jordan wrote:
> > 
> > John is right, in [perl table="delivery_schedule"
> > interpolate=1] the interpolate=1 is letting you be able to 
> > use [loop-date transactions order_number] inside the [perl], 
> > otherwise it would go... doink! [calc] interpolates automatically.
> > 
> > you could not use interpolate=1 and instead do:
> > 
> > [tmp foo][loop-data transactions order_number][/tmp]
> >  [perl table="delivery_schedule"]
> >     	my $apple = $Tag->data('transactions', 'order_number',
> > $Scratch->{foo});
> > 	return $apple;
> >  [/perl]
> > 
> > or if you were doing somehting more complicated, you would
> > want to have more
> > order:
> > 
> >  [perl table="delivery_schedule"]
> > 
> > 	my $table = 'transactions';
> > 	my $col = 'order_number';
> > 	my $key = $Scratch->{foo};
> >     	my $apple = $Tag->data($table, $col, $key);
> > 
> > # other stuff......
> > 
> > 	return $apple;
> > 
> >  [/perl]
> > 
> > If you use ITL in there, you need interpolate=1, and you
> > should always get into the habit of "return"ing something :)
> > 
> > Paul
> > 
> 
> I might be stating the obvious, but don't you also need the 
> 'transactions' table in the perl command?
> 
>   [perl table="delivery_schedule transactions"]
> 
> Best regards,
> 
> John.
> 
Just for tickles and grins I tried your suggestions and no-go.


Thanks thou,

Tim




More information about the interchange-users mailing list