Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
35%
Installation Wizard into new VRC
42%
Manual into existing VRC
3%
Manual into new VRC
19%
Total votes: 31

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 2nd April 2009, 12:40
Marioth's Avatar
Marioth Marioth is offline
Senior Member
 
Join Date: Aug 2001
Location: Ireland
Posts: 138
Marioth is on a distinguished road
Baan: BFCS,BMCS,BOCS, Triton 1 until 2.2, BaaN 3 until BaaN ERP (5), Ln 6.1 FP3 - DB: Oracle, Informix, B-Isam, C-Isam - OS: HP-unix, AIX, Sun Solaris, Digital, NT
sec.add.table
Baan: Other/Unknown
C/S: None/Unknown

Hi,

I am wondering if somebody used this function (sec.add.table) before and what the outcome was or is? I am using it in my script but it doesn't pick up the table. See below my script:
Code:
long teller

before.program:
        query.extend.select( "whinh431.* ")
        query.extend.from(   "whinh431")
        query.extend.where(  "whinh431._index2 = {whinh.oorg.sales,:tdsls401.orno}")
        teller = sec.add.table("bpmdm001")
Any explanation will be welcom?

Thanks,

Mario

Last edited by george7a : 2nd April 2009 at 17:20. Reason: adding baan code tags
Reply With Quote
  #2  
Old 2nd April 2009, 12:56
Marioth's Avatar
Marioth Marioth is offline
Senior Member
 
Join Date: Aug 2001
Location: Ireland
Posts: 138
Marioth is on a distinguished road
Baan: BFCS,BMCS,BOCS, Triton 1 until 2.2, BaaN 3 until BaaN ERP (5), Ln 6.1 FP3 - DB: Oracle, Informix, B-Isam, C-Isam - OS: HP-unix, AIX, Sun Solaris, Digital, NT
Oops I just realized that this post is in the wrong forum. Sorry but any command will be welcome.
Reply With Quote
  #3  
Old 2nd April 2009, 13:11
ulrich.fuchs's Avatar
ulrich.fuchs ulrich.fuchs is offline
Guru
 
Join Date: Aug 2001
Location: Germany
Posts: 514
ulrich.fuchs is on a distinguished road
Baan: IV, LN6.1 - DB: --- - OS: ---
This is the "secondary main table" feature, available from ERP LN FP3 (ikn fact it depends on the porting coming with that FP3, Tools Interface Version TIV 1075.).

Basically you can add a secondary table to a session using the query.extend and some functions. The primary key of that secondary table must match with that of the main table of the session. Then you just put the fields of the secondary main table to the form. The standard program will then do the update/insert actions also in that secondary table. It works pretty good.

Try to get the new version of the programmers guide help file, there is a section explaining these functions. If you have sources, look at the source of the employee dashboard, here these functions are used.


Uli
__________________

Dipl. Ing. Ulrich Fuchs
- ERP consulting and software development -
Widumestraße 18 - 44787 Bochum - Germany
mail@ulrich-fuchs.de - www.ulrich-fuchs.de
http://all-in-for-erp.com (Blog zu Infor LN))
Reply With Quote
  #4  
Old 2nd April 2009, 13:42
Marioth's Avatar
Marioth Marioth is offline
Senior Member
 
Join Date: Aug 2001
Location: Ireland
Posts: 138
Marioth is on a distinguished road
Baan: BFCS,BMCS,BOCS, Triton 1 until 2.2, BaaN 3 until BaaN ERP (5), Ln 6.1 FP3 - DB: Oracle, Informix, B-Isam, C-Isam - OS: HP-unix, AIX, Sun Solaris, Digital, NT
Danke

Hi Ulrich,

Thanks for that but we are on LN FP3, Tools Interface Version TIV 1075 and still it's not working for me. Maybe I am doing something wrong I don't know. Unfortunatly we don't have sources so I can't look in the recommended sources, so if anybody has another explanation please more then welcome.

Regards,

Mario
Reply With Quote
  #5  
Old 2nd April 2009, 17:20
george7a's Avatar
george7a george7a is offline
Guru
 
Join Date: May 2004
Location: Nazareth
Posts: 1,490
george7a is on a distinguished road
Baan: IVc, 5.0 b, 5.0 c, LN 6.1 - DB: MS SQL, Oracle - OS: Windows 2000, 2003 & UNIX
Quote:
Originally Posted by Marioth View Post
Oops I just realized that this post is in the wrong forum. Sorry but any command will be welcome.
Moved to the right one .
__________________
_
George Abdo
NAZDAQ - Your Documents, Your Way.
Reply With Quote
  #6  
Old 2nd April 2009, 17:25
george7a's Avatar
george7a george7a is offline
Guru
 
Join Date: May 2004
Location: Nazareth
Posts: 1,490
george7a is on a distinguished road
Baan: IVc, 5.0 b, 5.0 c, LN 6.1 - DB: MS SQL, Oracle - OS: Windows 2000, 2003 & UNIX
Hi again,

Here is the documentation that I have:
Quote:
Syntax:
function long sec.add.table (const string tablename())

Description
Add the passed table as a secondary table to the current session. This function call is only allowed from the before.program section.

Arguments
const string tablename() The table name to be added.

Return values
The id of the secondary table. This id must be used in subsequent calls to the functions sec.add.set(), sec.get.update.status(), sec.mark.delete() and sec.record.exists().

Context
This function can be used in script types.
I guess Uli has explained it better!
__________________
_
George Abdo
NAZDAQ - Your Documents, Your Way.
Reply With Quote
  #7  
Old 3rd April 2009, 10:58
Marioth's Avatar
Marioth Marioth is offline
Senior Member
 
Join Date: Aug 2001
Location: Ireland
Posts: 138
Marioth is on a distinguished road
Baan: BFCS,BMCS,BOCS, Triton 1 until 2.2, BaaN 3 until BaaN ERP (5), Ln 6.1 FP3 - DB: Oracle, Informix, B-Isam, C-Isam - OS: HP-unix, AIX, Sun Solaris, Digital, NT
Hi George,

This is what I have, but anyway it isn't working for me.

Multi Table Overview
In order to support editing multiple tables, so called 'secondary tables' are introduced. Secondary tables have a 1:1 relation with the main table. It is not required that there is a database reference from the maintable to the secondary table. However it must be possible to fetch a secondary table record through a 4GL-Engine query extend. Such a fetch must result in zero or one secondary table record. Comparable to the functionality for the main table, the 4GL-Engine will handle transactions / reads etc. for secondary tables. A secondary table requires that a DAL2 implementation is available for that table. It will not be possible to use unmodified 'old' sessions in a MT way. At least some parts of the UI script for the session must change.

Specific Requirements

The query.extend functionality must be handled very carefully. For secondary tables to work properly, it is necessary to add the complete secondary table record to the session query. Selecting only a part of the fields will result in data loss. (Fields that are not present in the query will be emptied on save). Furthermore, the query.extend REPLACE construction must be kept in mind. In the current design no measures are taken to protect the coupling with secondary tables. A query.extend REPLACE will destroy the coupling to a secondary table (if the developer doesn’t add the secondary tables as previous). Also care must be taken to use the “UNREF CLEAR” construction in the query.extend.where clause. The 4GL-Engine requires that when no reference to a secondary table record is found, the related record buffer is cleared.

When in a DAL script of a secondary table, the corresponding record from the maintable is needed, special care must be taken to prevent that the DAL of the secondary table overwrites the maintable record which is already read (and perhaps modified) by the 4GL-Engine. When a new secondary table record is added within the same transaction with the addition of a new maintable record, the DAL script of the secondary table record cannot yet fetch this maintable record from the database. Both above mentioned issues will be handled using the existing function: dal.get.object(). In the DAL script of the secondary table, the function dal.get.object() must be called to get the required maintable record. The implementation of this function will make sure that when the keyfields match with the keyfields of the current maintable record in the 4GL-Engine, no read from the database is done. Instead the 4GL-Engine maintained record is made actual.

The following standard program features are handled differently for secondary tables.

The 4GL-Engine will not generate the queries for retrieving and updating the secondary table records. The UI script of the application is responsible for passing the correct queries to the 4GL-Engine through the query.extend functions.
Maintain references and related reference buffers. The UI script of the application is responsible for filling reference fields referred to by secondary table fields (for instance descriptions).
Secondary tables without DAL2 scripts are not supported.
Auto complete in BW mode will not be available for secondary table fields.
Filters cannot use secondary table fields.
Secondary table fields cannot be shown above the grid as view fields.
The sort order is always based upon the available main table indices and not on secondary table indices.
Running MT sessions through application functionserver (AFS) is not supported.
When a main table record is deleted related secondary table records are not automatically deleted by the 4GL-Engine. The DAL of the main table is responsible for cleanup of related secondary table records.
Note
Multi Table functionality is available from Tools Interface Version (TIV)TIV 1075.

Example

before.program:
query.extend.select( "bpmdm001.* ", EXTEND_APPEND)
query.extend.from( "bpmdm001 ", EXTEND_APPEND)
query.extend.where( ":tccom001.emno REFERS TO bpmdm001 " &
"UNREF CLEAR and " &
EXTEND_APPEND)
g.bpmdm001.table.id = sec.add.table("bpmdm001")



Regards,

Mario
Reply With Quote
  #8  
Old 6th April 2009, 12:28
satish_pabathi satish_pabathi is offline
Junior Member
 
Join Date: Aug 2008
Location: Hyderabad
Posts: 25
satish_pabathi is on a distinguished road
Baan: Baan IV,Baan V,LN - DB: mssql,oracle - OS: Windows
Hi,
Try with this,because table name should start with 't' like 'tbpmdm001' .

g.bpmdm001.table.id = sec.add.table("tbpmdm001")

Regards,
satish
__________________
satish
Reply With Quote
  #9  
Old 6th April 2009, 15:35
Marioth's Avatar
Marioth Marioth is offline
Senior Member
 
Join Date: Aug 2001
Location: Ireland
Posts: 138
Marioth is on a distinguished road
Baan: BFCS,BMCS,BOCS, Triton 1 until 2.2, BaaN 3 until BaaN ERP (5), Ln 6.1 FP3 - DB: Oracle, Informix, B-Isam, C-Isam - OS: HP-unix, AIX, Sun Solaris, Digital, NT
Hi Satish,

I don't think so and I am not even trying it cos I bet you get an error if trying that.

Regards,

Mario
Reply With Quote
Sponsored Links
  #10  
Old 7th August 2015, 15:13
rajakumarswarna rajakumarswarna is offline
Newbie
 
Join Date: Jun 2015
Location: hyderabad
Posts: 2
rajakumarswarna is on a distinguished road
Baan: 6.1 - DB: db2 - OS: ubuntu
how to use dal.get.object , I want an example programe

Thanks
Reply With Quote
  #11  
Old 9th August 2015, 10:27
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,639
bdittmar will become famous soon enough
Baan: 2.2/3.1/4c4/LN6.1 FP6/FP9/HiDox - DB: tbase, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES
From DEV guide !

Quote:
Originally Posted by rajakumarswarna View Post
how to use dal.get.object , I want an example programe
Thanks
Hello,

dal.get.object()
Syntax:

function long dal.get.object (string tbl.name, long lock [, string key_field1] [, string key_value1], ...)

Description


Reads a record of the given table. In case the lock parameter is set to true, the record is locked for update. This function accepts a list of primary key field/value pairs.

The sequence of the actions is as follows:

The key fields are set according to the passed list of fields
The before.get.object hook is called with the DAL_FIND option
The record is read or locked
Record level permission is checked
The after.get.object hook is called with the DAL_FIND option
In case this function is called in the context of a 4GL-Session for a table which is either defined as the maintable or a secondary table for this session, this function will check if the requested record is already present in the 4GL-Engine buffers. If so, the 4GL-Engine record buffer is fetched and will not be read from the database. This is especially useful when in a DAL script of a secondary table the corresponding maintable record is needed.

Note
The dal.get.object() function will return the table fields which are updated through the UI script or by the UI. However, in case these table fields are changed in a DAL script before the dal.get.object() function is called, the dal.get.object() will overwrite these changes.


Arguments

string tbl.name the table name of the DAL.

long lock if true the record is locked for update

[string key_field1 ]
[string key_value1 ]
... List of primary key field / value pairs in the format "ppmmm999.ffff", value. In case of array elements, specify the field as "ppmmm999.ffff(element)"


Return values

0 Record is read or locked for update
DALHOOKERROR One of the hooks blocked the read action
DALNOOBJPERM No record level permission
>0 The error code of the read action in case this failed (e.g. ENOREC)

Context

This function can be used in all script types.

Hooks called

before.open.object.set() if this is the first call to the DAL
before.get.object()
after.get.object()
Error Handling

In case a database error occurs (a return value greater than 0), then this function will set an error message. E.g. in case a record is not found then an error message is set. So if you want to ignore such an error, make sure that you reset the dal error message stack by calling dal.reset.error.messages() or dal.clear.error.messages().

Note
This function is can be used in Update Sessions as well as Integrations via OpenWorld. However, be aware that since this function calls the before.get.object() and after.get.object() hooks it cannot match the performance of a BaanSQL query. So in most cases, it is advised to write your own query.

Regards
__________________
//Bernd
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


All times are GMT +2. The time now is 22:41.


©2001-2017 - Baanboard.com - Baanforums.com