Baanboard.com

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

User login

Frontpage Sponsor

Main

Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
18%
200 - 500 GB
29%
500 - 800 GB
3%
800 - 1200 GB
8%
1200 - 1500 GB
8%
1500 - 2000 GB
11%
> 2000 GB
24%
Total votes: 79

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old Yesterday, 12:34
Bender's Avatar
Bender Bender is offline
Junior Member
 
Join Date: Nov 2006
Location: Berlin
Posts: 15
Bender is on a distinguished road
Baan: BaaN IV and ERP Ln6.1 - DB: Oracle >= 9.2.0.3 -> Oracle 11g - OS: Linux-Windows-Solaris
Question Customer Defined Field can't hold his liquor
Baan: Infor ERP 10.7
C/S: Server

Hi there fellow Baanies

can i ask you a question about Extensions and Customer defined fields?

My Problem is as follows:
- created a table extension on table tisfc001
- created a customer defined field tisfc001.cdf_sord
that field has to be filled with the order number from tdsls402

My problem is, i just cannot set the value in the CDF. I can update other standard fields with my extension but i cannot fill the Customer defined Field

What i already did:
- defined the CDF in Declarations
extern domain ticdf___str030 tisfc001.cdf_sord

- set the fill of the CDF in Before.Save
| SLS Number
select * from tdsls402
where tdsls402.apdo = :tisfc001.pdno
as set with 1 rows
selectdo
tisfc001.cdf_sord = tdsls402.orno
endselect

- set the fill of the CDF in the CDF Field Logic Section in Update
| SLS Number
select * from tdsls402
where tdsls402.apdo = :tisfc001.pdno
as set with 1 rows
selectdo
tisfc001.cdf_sord = tdsls402.orno
endselect

I also tried to set the code in every other section possible, it just wont do the trick.



Can you please help a bro out here?

Last edited by Bender : Yesterday at 16:33.
Reply With Quote
  #2  
Old Yesterday, 20:39
BaanInOhio BaanInOhio is offline
Senior Member
 
Join Date: Oct 2005
Location: Northeast Ohio
Posts: 197
BaanInOhio is on a distinguished road
Baan: Baan 4c4, 5C, LN - DB: Informix, Oracle, SQL - OS: HP UX, Win2K
Try to use 'export' or 'put.var' for loading the CDF field. Direct assignments don't seem to work when using db.update instead of DAL.

Use a local variable and explicitly export each CDF in the ‘select’ clause if needed:

Code:
domain  tcdate  from.date, to.date

to.date =  ……    | set to.date to something that must be added to the CDF.
select tsacm101.*, tsacm101.cdf_rvdt:from.date
from   tsacm101 for update
where  tsacm101. ………..
selectdo
       if (from.date <> to.date) then   | update CDF when date is different
           ret = export(“tsacm101.cdf_rvdt”, to.date)    | put the contents of to.date into the tsacm101.cdf_rvdt field
           db.update(ttsacm101, db.retry)
           commit.transaction()
       endif
endselect
You can replace the ‘export’ function with ‘put.var’, which is the longer version of export where you can specify the process id, which is always the current process ID (‘pid’ predefined variable).

Code:
       ret = put.var(pid, “tsacm101.cdf_rvdt”, local.date)    | ‘pid’ is a predefined variable containing the current session process ID.

Using DAL to replace the "db.update" functions is a bit easier when CDFs are involved since an export/put.var isn't needed. A single "dal.set.field" is used when importing fields.

Code:
domain  tcdate  from.date, to.date

to.date =  ……    | set to.date to something that must be added to the CDF.
select tsacm101.*, tsacm101.cdf_rvdt:from.date
from   tsacm101 for update
where  tsacm101. ………..
selectdo
       if (from.date <> to.date) then   | update CDF when date is different
           ret = dal.change.object("tsacm101")
           if (ret = 0) then
               dal.set.field(“tsacm101.cdf_rvdt”, to.date)    | put the contents of to.date into the tsacm101.cdf_rvdt field
               ret = dal.save.object(“tsacm101”)
           endif
           if (ret = 0) then
               commit.transaction()
           else
               | report error
           endif
       endif
endselect
Reply With Quote
  #3  
Old Today, 10:20
JaapJD's Avatar
JaapJD JaapJD is offline
Guru
 
Join Date: Sep 2002
Location: Netherlands
Posts: 852
JaapJD will become famous soon enoughJaapJD will become famous soon enough
Baan: BaanIV, BaanERP, ERP LN 6.1 - DB: Oracle, SQL Server - OS: Unix, Windows
Giving the CDF the value if the Sales Order number in the Before Save hook is the best solution. The reason that it doesn't work maybe the fact that you declared the CDF yourself.
Quote:
- defined the CDF in Declarations
extern domain ticdf___str030 tisfc001.cdf_sord
Remove this and try again.
Reply With Quote
  #4  
Old Today, 11:53
Bender's Avatar
Bender Bender is offline
Junior Member
 
Join Date: Nov 2006
Location: Berlin
Posts: 15
Bender is on a distinguished road
Baan: BaaN IV and ERP Ln6.1 - DB: Oracle >= 9.2.0.3 -> Oracle 11g - OS: Linux-Windows-Solaris
thx BaanInOhio but unfortunatly the set.var, export did not help.


Plus, in an extension on table extension level, you cannot use commit.transaction as you are already in a transaction.



Quote:
Originally Posted by BaanInOhio View Post
Try to use 'export' or 'put.var' for loading the CDF field. Direct assignments don't seem to work when using db.update instead of DAL.

Use a local variable and explicitly export each CDF in the ‘select’ clause if needed:

Code:
domain  tcdate  from.date, to.date

to.date =  ……    | set to.date to something that must be added to the CDF.
select tsacm101.*, tsacm101.cdf_rvdt:from.date
from   tsacm101 for update
where  tsacm101. ………..
selectdo
       if (from.date <> to.date) then   | update CDF when date is different
           ret = export(“tsacm101.cdf_rvdt”, to.date)    | put the contents of to.date into the tsacm101.cdf_rvdt field
           db.update(ttsacm101, db.retry)
           commit.transaction()
       endif
endselect
You can replace the ‘export’ function with ‘put.var’, which is the longer version of export where you can specify the process id, which is always the current process ID (‘pid’ predefined variable).

Code:
       ret = put.var(pid, “tsacm101.cdf_rvdt”, local.date)    | ‘pid’ is a predefined variable containing the current session process ID.
Using DAL to replace the "db.update" functions is a bit easier when CDFs are involved since an export/put.var isn't needed. A single "dal.set.field" is used when importing fields.

Code:
domain  tcdate  from.date, to.date

to.date =  ……    | set to.date to something that must be added to the CDF.
select tsacm101.*, tsacm101.cdf_rvdt:from.date
from   tsacm101 for update
where  tsacm101. ………..
selectdo
       if (from.date <> to.date) then   | update CDF when date is different
           ret = dal.change.object("tsacm101")
           if (ret = 0) then
               dal.set.field(“tsacm101.cdf_rvdt”, to.date)    | put the contents of to.date into the tsacm101.cdf_rvdt field
               ret = dal.save.object(“tsacm101”)
           endif
           if (ret = 0) then
               commit.transaction()
           else
               | report error
           endif
       endif
endselect
Reply With Quote
  #5  
Old Today, 11:54
Bender's Avatar
Bender Bender is offline
Junior Member
 
Join Date: Nov 2006
Location: Berlin
Posts: 15
Bender is on a distinguished road
Baan: BaaN IV and ERP Ln6.1 - DB: Oracle >= 9.2.0.3 -> Oracle 11g - OS: Linux-Windows-Solaris
Hi there JaapJD and thx too.
I removed the declaration but still no luck



Quote:
Originally Posted by JaapJD View Post
Giving the CDF the value if the Sales Order number in the Before Save hook is the best solution. The reason that it doesn't work maybe the fact that you declared the CDF yourself.

Remove this and try again.
Reply With Quote
Sponsored Links
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
Customer Defined Field Mohammad1911 Tools Development 6 10th February 2014 05:52
customer defined field Predator Tools Development 6 1st July 2011 07:36
Compilation Error baansavvy Tools Development 4 20th April 2010 17:25
Form Field Order Eddie Monster Tools Development 3 23rd August 2006 20:58
User defined aggregate field names for reports ulrich.fuchs Enhancements 4 13th May 2004 09:41


All times are GMT +2. The time now is 19:55.


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