[ic] decrement inventory in an additional table

Kevin Walsh interchange-users@icdevgroup.org
Sun Aug 25 22:24:00 2002


>  I need to decrement the inventory  in an additional table besides
> inventory. In log_transaction I copied the code:
>
> [if variable DECREMENT_INVENTORY]Inventory of [item-code] now:
>         [data
>                 table=menge
>                 col=quantity
>                 key="[item-code]"
>                 increment=1
>                 value="-[item-quantity]"
>         ]
> [/if]
>
> but it does not work ... it might be because my table "menge" has 2 keys
> defined , i am not sure. In the log it only shows up with "-the number" I
> ordered but no change to the quantity column.
>
> How can I do this ? I tried directly with mysql but it just wrote the code
> to the log or it just didnīt do anything .....
>
> menge is a table with following columns: sku, username, quantity - here the
> quantity i supposed to be decreased on order, here and in the inventory
> table. keys are sku and username (to eliminate duplicates)
> I have IC 4.8
>
You didn't specify whether any error messages were reported in your
error.log file(s).

A couple of things to check:

  1. Do you have a dbconf/mysql/menge.mysql file, or have you declared
     your table to Interchange in some other way?

  2. At the top of your etc/log_transactions file, you should have code
     that looks similar to the following:

         [loop list="transactions orderline inventory userdb"]
             [flag type=write table="[loop-code]"]
         [/loop]

     Have you added "menge" to the list of tables to be given write
     permission?

A quick look in your error.log will tell you whether Interchange
was denied write permission, or whether it simply doesn't know about
your "menge" table.

If rows in your "menge" table cannot be uniquely identified by the
item code then you will not be able to use the [data] tag in the
way you quoted above; Use [query] instead.

--
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/