User login
|
|
|
Frontpage Sponsor
|
|
|
Poll
|
Would you like to see a separate forum on Baanboard for the ION product? No 14% Yes 86% Total votes: 80 |
Baanboard at LinkedIn
|

|
|
|
 |

4th May 2004, 16:53
|
|
Newbie
|
|
Join Date: Oct 2003
Posts: 2
|
|
|
Baan: Baan IV, Baan ERP -
DB: ORACLE -
OS: UNIX
|
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
|

4th May 2004, 17:15
|
 |
Guru
|
|
Join Date: Dec 2001
Location: Lisle, IL, USA
Posts: 1,146
|
|
|
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.
|

5th May 2004, 09:57
|
|
Newbie
|
|
Join Date: Oct 2003
Posts: 2
|
|
|
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
|

5th May 2004, 14:29
|
 |
Guru
|
|
Join Date: Sep 2001
Location: Louisville, KY, USA
Posts: 5,941
|
|
|
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
|

16th June 2004, 21:53
|
 |
Senior Member
|
|
Join Date: Jan 2003
Location: Montreal, Canada
Posts: 256
|
|
|
Baan: Baan IVc3 A&D -
DB: Oracle -
OS: IBM AIX
|
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
|

16th June 2004, 22:25
|
 |
Guru
|
|
Join Date: Sep 2001
Location: Louisville, KY, USA
Posts: 5,941
|
|
|
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
|

17th June 2004, 14:40
|
 |
Senior Member
|
|
Join Date: Jan 2003
Location: Montreal, Canada
Posts: 256
|
|
|
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
|

17th June 2004, 15:41
|
 |
Guru
|
|
Join Date: Sep 2001
Location: Louisville, KY, USA
Posts: 5,941
|
|
|
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
|

17th June 2004, 23:22
|
 |
Guru
|
|
Join Date: Aug 2001
Location: Pacific NW, USA
Posts: 2,890
|
|
|
Baan: iBaanERP-5.2a(Reger), SSA-ERP-LN-6.1(Gemini) -
DB: Oracle -10g-R1 -
OS: HP-UX-11.11, 11.23 (Itanium, RISC)
|
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.
|

18th June 2004, 15:43
|
|
Member
|
|
Join Date: Nov 2003
Location: Moscow, Russia
Posts: 43
|
|
|
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.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|