Baanboard.com

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

User login

Frontpage Sponsor

Main

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


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 16th March 2010, 14:18
en@frrom en@frrom is offline
Guru
 
Join Date: Aug 2003
Location: Belgium
Posts: 1,218
en@frrom will become famous soon enough
Baan: B50B - DB: Oracle 8.0 - OS: Win2k AS
Copy text between companies
Baan: Other/Unknown
C/S: None/Unknown

Hey all,

I am writing a session to dynamically copy texts from one company to another based on tables in a file and/or form selection.

I have come across a function text.copy.between.companies() in the help file (see below). I tried to use it, but no results. I always get return value 0, and no text is created nor updated.

Quote:
long text.copy.between.companies( string text_field_to(17), string text_field_from(17), long source_company, long target_company, string kw1(17), string kw2(17), string kw3(17), string kw4(17), string tgroup(8), string edit_opt(15) )
Description

This copies the entire text of a specified text field, for all languages, from one company to another.
Arguments

text_field_to The name of the new text field. See Text fields: overview. This returns the text number for the new text field.
text_field_from The name of the text field that must be copied. See Text fields: overview.
source_company This specifies the source company.
target_company This specifies the destination company.
kw1 to kw4 Use these arguments to specify key words for the new text. If you specify one or more of these arguments as an empty string, the corresponding key word(s) are copied from the original text. It is possible, for example, to specify two new key words and to copy the other two from the original text.
tgroup This specifies the name of the text group to which the new text must be assigned. If you specify an empty string here, the text is assigned to the user"s default group.
edit_opt This specifies the type of window in which the text must be displayed.

Return values

>0 success; returns the number of lines copied
-1 error
I have tried with and without commit.transaction(), with or without selection for update, no results.

Does anybody know this function and can tell me if it works and how to use it?

Thanks in advance!


Regards,
Eli Nager
__________________
Member of Baan Board

Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #2  
Old 16th March 2010, 15:23
bdittmar's Avatar
bdittmar bdittmar is offline
Guru
 
Join Date: Apr 2002
Location: Germany, 50.584097,8.544078
Posts: 1,328
bdittmar is on a distinguished road
Baan: 2.2/3.1/4c4/LN6.1 FP6/HiDox - DB: bisam, ms-sql7, oracle10gV1, 11g - OS: HP-UX, W2K3, SLES
Post #include <bic_text>

Quote:
Originally Posted by en@frrom View Post
Hey all,

I am writing a session to dynamically copy texts from one company to another based on tables in a file and/or form selection.

I have come across a function text.copy.between.companies() in the help file (see below). I tried to use it, but no results. I always get return value 0, and no text is created nor updated.



I have tried with and without commit.transaction(), with or without selection for update, no results.

Does anybody know this function and can tell me if it works and how to use it?

Thanks in advance!


Regards,
Eli Nager
Hello eli,

found this hint on BaaNboard :

#include <bic_text>

Regards
__________________
//Bernd
Reply With Quote
  #3  
Old 16th March 2010, 15:32
en@frrom en@frrom is offline
Guru
 
Join Date: Aug 2003
Location: Belgium
Posts: 1,218
en@frrom will become famous soon enough
Baan: B50B - DB: Oracle 8.0 - OS: Win2k AS
Bernd,

Thanks for your reply. Obviously I included the bic_text, otherwise my script wouldn't even compile.

I already got it working meanwhile. I had entered as the first two arguments for the function (new text and orig.text) the text fields, but it had to be the text numbers. Also a db.update of the update table is necessary followed by a commit.transaction(). The commit is also for the tttxt tables. Those will not be updated with the new text number until a commit.


Regards,
Eli
__________________
Member of Baan Board

Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #4  
Old 16th March 2010, 16:43
günther günther is offline
Guru
 
Join Date: Jan 2002
Location: Ehingen, Germany
Posts: 502
günther is on a distinguished road
Baan: IVc4 - DB: Informix - OS: HP-UX
Here is my working example (some archiving to a company 999):

Code:
function test()
{
  long old.txta
 
  db.retry.point()
  select tdsls040.*
  from tdsls040
  as set with 1 rows
  selectdo
    | SAVE ORIGINAL TEXT NUMBER!
    old.txta = tdsls040.txta
 
    tdsls040.txta = 0
    tdsls040.txtb = 0
    tdsls040._compnr = 999
    db.insert(ttdsls040, db.retry+db.skip.dupl)
  endselect
  commit.transaction()
 
  long rc
  string tgroup(8)
  string edit_opt(15)
 
  rc = text.defaults("tdsls040.txta", tgroup, edit_opt)
 
  db.retry.point()
  select tdsls040.*
  from tdsls040 for update
  where tdsls040._index1 = {:tdsls040.orno}
  and tdsls040._compnr = 999
  selectdo
    | set tdsls40.txt to the original text number
    tdsls040.txta = old.txta
 
    rc = text.copy.between.companies("tdsls040.txta", "tdsls040.txta",
       get.compnr(), 999, "kw1", "kw2", "kw3", "kw4", tgroup, edit_opt)
 
    | now the text is copied, and tdsls040.txt has the new value
    db.update(ttdsls040, db.retry)
  endselect
  commit.transaction()
}

Günther
Reply With Quote
  #5  
Old 17th August 2010, 00:30
shashig shashig is offline
Newbie
 
Join Date: Jul 2009
Posts: 1
shashig is on a distinguished road
Baan: BaaN IV c4, ERP LN6.1 - DB: Informix, Oracle - OS: Windows and Unix
Thanks

Hey thanks a lot ... your solution solved my problem.

Shashi
Reply With Quote
  #6  
Old 17th August 2010, 04:09
BaanInOhio BaanInOhio is offline
Senior Member
 
Join Date: Oct 2005
Location: Northeast Ohio
Posts: 145
BaanInOhio is on a distinguished road
Baan: Baan 4c4, 5C, LN - DB: Informix, Oracle, SQL - OS: HP UX, Win2K
Quote:
Originally Posted by en@frrom View Post
Bernd,

Thanks for your reply. Obviously I included the bic_text, otherwise my script wouldn't even compile.

I already got it working meanwhile. I had entered as the first two arguments for the function (new text and orig.text) the text fields, but it had to be the text numbers. Also a db.update of the update table is necessary followed by a commit.transaction(). The commit is also for the tttxt tables. Those will not be updated with the new text number until a commit.


Regards,
Eli
The 'text_field_from' and 'text_field_to' fields are strings that contain the name of the fields involved in the copy. One or both may be the name of a table field (extern by default) and/or the name of a local long variable that must be declared as extern. Failure to use extern long variables when other than table fields will result in the returned text number as zero.
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
Dynamic Copy of Texts between companies en@frrom Tools Development 4 12th March 2010 14:53
COPY -PASTE in TEXT Field Sachinjoshi Tools Administration & Installation 5 7th November 2007 11:37


All times are GMT +2. The time now is 08:54.


©2001-2013 - Baanboard.com - Baanforums.com