Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
18%
200 - 500 GB
26%
500 - 800 GB
3%
800 - 1200 GB
9%
1200 - 1500 GB
12%
1500 - 2000 GB
12%
> 2000 GB
21%
Total votes: 34

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 4th May 2004, 17:53
c_siek c_siek is offline
Newbie
 
Join Date: Oct 2003
Posts: 2
c_siek is on a distinguished road
Baan: Baan IV, Baan ERP - DB: ORACLE - OS: UNIX
copy records

Hi all,

I want to copy all data from one record of a file to another (existing) record of the same file.
How can I manage this?

Thanks in advance
Christiane
Reply With Quote
  #2  
Old 4th May 2004, 18:15
lbencic's Avatar
lbencic lbencic is offline
Guru
 
Join Date: Dec 2001
Location: Lisle, IL, USA
Posts: 1,148
lbencic will become famous soon enough
Baan: 2.2d - LN - DB: most - OS: most
If you are sure you want to overwrite the existing one, you can remove the target record (db.delete) change the key field of the source to the target key field, then do a db.insert.

Edited: You could also read the new record for update, then assign the new values field by field, then use db.update to update that record. If you are changing key fields, even secondary indexes, you should use the delete / reinsert.
Reply With Quote
Sponsored Links
  #3  
Old 5th May 2004, 10:57
c_siek c_siek is offline
Newbie
 
Join Date: Oct 2003
Posts: 2
c_siek is on a distinguished road
Baan: Baan IV, Baan ERP - DB: ORACLE - OS: UNIX
Hi Lisa,

sorry, your solution didn't work because I get a reference error when deleting the target record.

Is there any chance to work with db.bind(), db.columns.to.record() and db.record.to columns() ?
Just to store the values from the source record into a buffer and then changing the key and do an update?

I don't want to copy field by field because then I have to change my script each time the Table definition changes
Reply With Quote
  #4  
Old 5th May 2004, 15:29
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,147
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Use record buff

I do something like that using the table record buffer:

Code:
function store.tpppc210.record.buffer()
{
	if not record.len then
		db.row.length(ttpppc210, record.len)
		alloc.mem(record.buf, record.len)
	endif
	record.buf = rcd.ttpppc210
}

Then you can go delete the original record. Restore the table buffer using rcd.ttpppc210 = record.buf, change fields, then do a db.insert.

Mark
Reply With Quote
  #5  
Old 16th June 2004, 22:53
cherokee's Avatar
cherokee cherokee is offline
Senior Member
 
Join Date: Jan 2003
Location: Montreal, Canada
Posts: 298
cherokee is on a distinguished road
Baan: Baan IVc3 A&D - DB: Oracle - OS: IBM AIX
Thumbs up

Hello,

I am using the example you gave here.

I defined the buffer record.buf as:

string record.buff(1,1) based

then I stored some records in there.
should I use the function "load" to retrieve values in my record.buff? or how can i retrieve the values in my record.buff array?

Thanks,

Carlos
Reply With Quote
  #6  
Old 16th June 2004, 23:25
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,147
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
More info on what you are trying to do may help someone answer your question. In the example above I actual declare record buffer like this:
Code:
	string		record.buf(1)	based

I only use it to hold the current record. So for example if I want to copy a record with only a key change then I can set rcd.<tablename> to record.buf, then insert. I have never used it to hold multiple records. I am not sure how you would search this string array.

Mark
Reply With Quote
  #7  
Old 17th June 2004, 15:40
cherokee's Avatar
cherokee cherokee is offline
Senior Member
 
Join Date: Jan 2003
Location: Montreal, Canada
Posts: 298
cherokee is on a distinguished road
Baan: Baan IVc3 A&D - DB: Oracle - OS: IBM AIX
Mark,

Yes, can store several records in the buffer and use the original table to retrieve the values in my buffer by doing rcd.<table> = record.buf(1,i), no commits, not inserts, just reading.

Acctually I wanted to use it as tempory table. I am almost sure that there is another way to create a ram table, isn't?


Thanks,

Carlos
Reply With Quote
  #8  
Old 17th June 2004, 16:41
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,147
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Yeah - I can see where that would work. Store a bunch of records in the buffer array, reset each record with rcd.<tablename> = record.buff(1,i), then do some checks on the table fields. I can see where that would work. I can not think of anything better if you have to have a ram table and do not want to create and actual table.

Mark
Reply With Quote
  #9  
Old 18th June 2004, 00:22
NPRao's Avatar
NPRao NPRao is offline
Guru
 
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 3,073
NPRao will become famous soon enough
Baan: Baan 4-5,5.2(Reger),LN-6.1,Infor LN-10.x - DB: Oracle,MS-SQL - OS: HPUX, Linux, Windows
Quote:
Acctually I wanted to use it as tempory table. I am almost sure that there is another way to create a ram table, isn't?
Carlos,

I see that you are on BaaN-4 I am not sure if these options are available to you.

Quote:
BaanERP Application Software Engineering Guides
Caching table data and table boosters
--------------------------------------------------------------------------------

There is a close relationship to the table boosters, which can be maintained by the Table Boosters (tcmcs0598m000) session.

A table is cached by:

Activating a table booster in the Table Boosters (tcmcs0598m000) session.
An application program always uses table caching for a table.
If functionality of this DLL tccomdll0201 is applied in an application program, and the table booster is set to:

Full the table is loaded fully in internal memory, on the first access of that table. Each other access will be an access to internal memory.
Incremental, each accessed row of that table is stored in internal memory.
However, if a table cache is hard programmed in an application program, that table is loaded as programmed, independent of the table booster. In most times these tables are used as scratch tables, i.e. only internal memory will be used for writing, updating, deleting and sorting data.

An table booster will be written into tcmcs098 as inactive when one of the idb functions from DLL tccomdll0201 has been called for the first time for the currently running session.
When the same session has been ran for the second time the session will search for an active table booster on next priority:
1. table, session, user
2. table, session
3. table, user
4. table

So, by default an inactive table boosters will be written with only table and session filled.
Note: When record(s) has been found in one of the 4 situations, no default record will be generated anymore.
One can activate a booster by setting the value of the field VALID from 'inactive' to 'manual', 'manual/job' or 'job'.

And after that one can optionally perform the next different actions:

Make the booster user specific by copying the booster and fill the user code. A booster will become user dependent.
Make the booster more general by copying the booster and make session empty. This means that the specific table will be cached for all sessions for one user only.
The boosters per table, session (2) and table, session, user (1) should be removed in that case.
Make the booster more general by copying the booster and empty the session code and user code. This means that the specific table will be cached for all sessions.
The boosters per table, user (3) and table, session (2) and table, session, user (1) should be removed in that case.
Quote:
Function idb.init()
--------------------------------------------------------------------------------

Syntax
function extern long idb.init(string table.name(8), string where.condition(512), long index.number, long number.of.fields,const string table.columns(,) [, long company.number [, const long full.load [, const long max.nr.rows [, const long physical.access]]]])

Description
This function initializes the caching functionality. The given table will be accessed in right index and memory will be allocated.
An initial 'where' condition can be given, which is valid for each read access on a table. It is possible to enter a selected list of fields, that should be cached.
Also can be specified if the caching will be done by setting the table boosters or not. If not, the load option (full/incremental) and the number of rows can be specified by function parameters.
Also can be specified if the caching is done physically or not.
The implementation of this function is optional.

Arguments
table.name Table name e.g. "ppmmm000"
where.condition Where condition as data filter (can be empty).
index.number The index number in the table on what all operations should be performed on.
number.of.fields The number of colums that has to be cached. Default is 0 (zero), which means that all columns should be cached.
table.columns An array with table columns. This can be empty when all columns are required.
company.number The company number where the cache functions should operate with. This argument is optional. Default is the current company number.
full.load TRUE means that all records will be loaded (where.condition will be taken into account). FALSE means that 'incremental' cache is active. -1 means that this value has to be taken from the table booster setting.
max.nr.rows The maximum number of rows to be cached. -1 means that this value has to be taken from the table booster setting.
physical.access This parameter indicates whether physical access should be done or not. When it is set to FALSE, only function idb.load() will perform physical access. The other idb functions are only accessing the internal memory.

Output
0 : OK
-1: Index doesn't exist.
I heard the terms Virtual Tables in BaaN, but I dont have much information. I believe the table exist but do not have any data in it.
__________________
The art of perfection does not lie in doing extraordinary things but, doing ordinary things extraordinarily well. [-N. Prashanth Rao]
How To Ask Questions The Smart Way,BaaNBoard,NPRao
Reply With Quote
  #10  
Old 18th June 2004, 16:43
BaanForever BaanForever is offline
Member
 
Join Date: Nov 2003
Location: Moscow, Russia
Posts: 43
BaanForever is on a distinguished road
Baan: IVc4 - DB: Oracle 8 - OS: Win NT
Mark is right - it's the best way.
Also In the function itfgld0038 present universal solution.
Code:
    #define itfgld0038.dim.rcd(X)
^       static  string  itfgld0038.buf##X(1)    based
^       static  long    itfgld0038.len##X

    #define itfgld0038.store.rcd.fields(X) {
^       if not itfgld0038.len##X then
^           db.row.length(##X, itfgld0038.len##X)
^           alloc.mem(itfgld0038.buf##X, itfgld0038.len##X)
^       endif
^       itfgld0038.buf##X = rcd.##X
^   }

    #define itfgld0038.store.rcd.fields.no.lock.info(X) {       
^       if not itfgld0038.len##X then
^           db.row.length(##X, itfgld0038.len##X)
^           alloc.mem(itfgld0038.buf##X, itfgld0038.len##X-6)
^       endif
^       itfgld0038.buf##X = rcd.##X
^   }                               

    #define itfgld0038.restore.rcd.fields(X) {
^       rcd.##X = itfgld0038.buf##X
^   }
so you can use
Code:
itfgld0038.store.rcd.fields(YourTableName)
itfgld0038.restore.rcd.fields(YourTableName)
__________________
Sorry for my English.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
copy data from a table of one company to same table of another company Deepali Tools Development 9 26th November 2014 20:06
Select distinct records thru query extension?? arajasek Tools Development 5 25th August 2010 08:24
Losed tfgld418 records - Urgent Help Please mprakash Finance, Invoicing and Integration 13 25th September 2004 10:26


All times are GMT +2. The time now is 21:44.


©2001-2018 - Baanboard.com - Baanforums.com