Transfer between datasets

How do I transfer an item from the stocktable in one dataset to the stocktable in another dataset.

TIA
Dino
  • Hi,

    you could use something like this:

    #MacroLoad(C_UTIL)

    introduce Stocktable[itemidx, '0101']
    process #PROC_DBChange 'Mode=Temp File=DMO PROC=24 args=xal=StockCreateItem' using Stocktable

    in the job StockCreateItem you could use:

    extern StockTable
    #DBUpdate(StockTable)

    Orvar
  • quote:
    Originally posted by bobdino

    How do I transfer an item from the stocktable in one dataset to the stocktable in another dataset.



    Also, if you are using an SQL database system (such as ORACLE) you can create a macro thus :

    #LocalMacro.SQLChangeDataSet
    IF #DB_File(FILESTR(%1),FILE)==0 THEN
    SET SQLPrepare("UPDATE "+#SQLTableName(%1))
    SET SQLPrepare("SET DATASET='"+%2+"'")
    SET SQLPrepare("WHERE DATASET='"+#DB_Dictionary(EXT)+"'")
    SET SQLPrepare(" AND "+#SQLRowNumber+"="+Num2Str(%1.RowNumber,0,0,0,0))
    SET &MacroInt = SQLExecute("")
    ENDIF
    #EndMacro

    If you had a stocktable record in dataset 'BOB' and wanted to move it to 'JIM' then you'd call it thus :
    #SQLChangeDataset(StockTable, "JIM")

    Be aware though that if the record breaks a unique index rule when moved you will get an SQL error.

    Barny


Related
Recommended