[ic] Data tag not returning result

Paul Jordan paul at gishnetwork.com
Wed May 12 14:44:43 EDT 2004


interchange-users-bounces at icdevgroup.org wrote:
>> -----Original Message-----
>> From: interchange-users-bounces at icdevgroup.org
>> [mailto:interchange-users-bounces at icdevgroup.org] On Behalf
>> Of Paul Jordan
>> Sent: Wednesday, May 12, 2004 11:16 AM
>> To: interchange-users at icdevgroup.org
>> Subject: RE: [ic] Data tag not returning result
>>
>>
>> Tim Good [draco at edsd.com] wrote:
>>> Hello list,
>>>
>>> (mysql 3.23.58 on Redhat 8.0 non threaded perl 5.8.2 interchange 5.2
>>> stable) I have a custom table I have added to my database
>>> "delivery_schedule". In the order_view page, in admin, I would like
>>> to pull data from this table
>>>
>>> according to the order_number being viewed. I have a field
>>> "order_number" in the delivery_schedule table which get the
>>> order_number from transactions when the order is placed.
>>>
>>> I have tried several different approaches to solve this task.
>>> However, none are working. What is the best way to do this?
>>>
>>> Thanks much,
>>> Tim
>>>
>>
>>
>> Next time include code we can help fix.
>>
>>
>>     [query
>>         ml=100
>>         type=list
>>         sp="@@MV_PAGE@@"
>>         sql=|
>>             SELECT  foo, bar
>>             FROM    delivery_schedule
>>             WHERE   order_number = '[however your getting the
>> order number]'
>>          |]
>>         [on-match]
>>             Delivery Detial:
>>         [/on-match]
>>         [list]
>>             Delivery Schedule #[sql-increment]: [sql-bar]<br>
>>         [/list] [no-match]
>>             Order is not yet in transit
>>         [/no-match]
>>     [/query]
>>
>>
>> ----------
>>
>> [however your getting the order number] is however you can
>> grab the order number on that page, maybe a CGI arg, or a
>> value, or scratch, i dunno, you'll have to see what it is giving you.
>>
>> HTH
>> Paul
>>
>>
> Paul,
>
> Thank you for the response. I was using the code below:
>
> [query sql="select charge from delivery_schedule where order_number =
> [loop-data transactions order_number]" type=list]
>     [if-sql-param charge]
>          [sql-param charge]
>     [/if-sql-param]
> [/query]
>
> However, I need to use the results in later areas eg.
> [total_view subtotal="[loop-data transactions subtotal]"
> install="[loop-data transactions install_chrg]" delivery="[sql-param
> charge]" ] Total_view is a custom Usertag I developed to return
> different totals depending on view and charges.
> For instance weither or not there is a delivery charge. I have tried
> to wrap the above query in [seti][/seti]
> tags then use [scratch foo] to return in delivery="[scratch foo]".
> This works once but when I call it later it dosen't.
>
> Then I tried:
> [perl table='delivery_schedule']
>   $Tag->data("delivery_schedule", "charge", "[loop-data transactions
> order_number]"); [/perl] This returns nothing.
>
> Also tried to have the query tag ecapsulate the whole area where
> [sql-param charge] is needed. However, if there are no results the
> "whole area is blank".
>
> Any ideas?


I am not following where and how the UserTag is being used, and how many times,
but here is a guess:

[tmpn total_charge]0[/tmpn]

 [query sql="select charge
		  from delivery_schedule
		  where order_number = '[loop-data transactions order_number]'
	" type=list]
	[list]
      [if-sql-param charge]
         Line item charge:  [calc]
						my $charge = q{[sql-param charge]};
						$Scratch->{total_charge} += $charge;
						return $charge;
					[/calc]
      [/if-sql-param]
	[/list]
 [/query]

....

Total Charge:
[total_view subtotal="[loop-data transactions subtotal]"
	install="[loop-data transactions install_chrg]"
	delivery="[scratch total_charge]" ]


Or am I not understanding something?

Paul





More information about the interchange-users mailing list