Baanboard.com

Baanboard.com (http://www.baanboard.com/baanboard/index.php)
-   Tools Development (http://www.baanboard.com/baanboard/forumdisplay.php?f=8)
-   -   text.write does not return new text number (http://www.baanboard.com/baanboard/showthread.php?t=9968)

ahulikavi 12th May 2003 06:56

text.write does not return new text number
 
We are using text.write function to create Sales Order texts from .txt files. After changing to poting set 6.1c.06.07 and
upgrading to SP11 text.write functions is returning existing text number instead of creating new text.

eg :

Existing text no 23456 having 1 line of text
tmp.file is a text file having 15 lines of text

Code:

t.no =  text.write( "txt.name", "2", kw1,kw2, kw3, kw4, "", "",  tmp.file )

if t.no < 0 then
        message("Error Writing Text for Order No /n %d", tdsls040.orno)
else
        commit.transaction()
        message("Writing Text for Order No /n %d", tdsls040.orno)
endif


after
Code:

t.no =  text.write( "txt.name", "2", kw1,kw2, kw3, kw4, "", "",  tmp.file )
t.no = 15 -> this is right, as expected it should return the number of line written which is 15
txt.name -> should return a new text number, instead it returns 23456, which already exists

I get the message "Writing Text for Order No ...", which means transaction is commited.
Now if you see text 23456 in Maintain Texts it shows the original text with 1 line.


As I see it text.write is not creating a new text for some reason.

Am I missing something here?, Baan support is unable to help (as usual !!).

:confused:

OmeLuuk 12th May 2003 10:09

What if
 
Currently your call is using defaults for textgroup and textwindow (tgroup and edit_opt, see here). What if you do not depend on the user determined defaults? And your file really does contain only plain text (no "strange tss characters" Windows sometimes put into plain text files)?

klixy23 12th May 2003 12:03

Quote:

t.no = text.write( "txt.name", "2", kw1,kw2, kw3, kw4, "", "", tmp.file )
Is <bic_text> included?
Is "txt.name" (the text_field argument) a "text" type database table field or an externally declared long variable?

Have a nice day!

ahulikavi 12th May 2003 13:21

Hi Omeluuk and Klixy,

Thanks for your replies,

Quote:

What if you do not depend on the user determined defaults? And your file really does contain only plain text (no "strange tss characters" Windows sometimes put into plain text files)?
I have checked text group, text window, text authorisations seems to be no problem there. Text is pure DOS text no tss characters.

In fact this session was working fine till we upgraded the porting set and Service pack as mentioned before. Attaching a sample text file for your ref.

OmeLuuk 12th May 2003 13:37

Otherwise, try to debug with -- -set TT_SQL_TRACE=number and/or -- -set DBSLOG=number. Then you will be able to see what transactions are done and what records will be handled, depending on what number you will choose. See for options the settings file in this thread.
Quote:

Tracing and Logging:
--------------------------------------------------------------------------------
2.1 "-- -set TT_SQL_TRACE=value (or added values)" Logging
information from the Baan database driver. Maximum value = 0277367
-set TT_SQL_TRACE=0000001 Parse Query Strings and show information
-set TT_SQL_TRACE=0000002 Show RDD usage of Query
-set TT_SQL_TRACE=0000004 Final Dump info queries
-set TT_SQL_TRACE=0000020 Database Actions ("Operand" "Operator")
-set TT_SQL_TRACE=0000040 Show queries wih their QID
-set TT_SQL_TRACE=0000100 Mode of query
-set TT_SQL_TRACE=0000200 Show query exec. times
-set TT_SQL_TRACE=0001000 Show table dependencies (matrices)
-set TT_SQL_TRACE=0002000 Show calls of internal SQL functions
-set TT_SQL_TRACE=0004000 Show query eval. plan (client+server)
-set TT_SQL_TRACE=0010000 Show quey ev. plan (server)
-set TT_SQL_TRACE=0020000 Show all full table scans
-set TT_SQL_TRACE=0040000 Database Action Messages
-set TT_SQL_TRACE=0200000 Query Distribution Plan
-set TT_SQL_TRACE=0400000 Show current time to level of milliseconds

Note: After startup TT_SQL_TRACE can be set, raised or lowered with bshcmd:
-T "TT_SQL_TRACE=value" set to value
-T "TT_SQL_TRACE+value" add bits to current value
-T "TT_SQL_TRACE-value" remove bits from current value

2.3 "-- -set DBSLOG=value (or added values)" Logging information
from the online processing of the database driver.
-set DBSLOG=0000001 Data dictionary info of tables
-set DBSLOG=0000002 Query info (SQL level 1)
-set DBSLOG=0000004 Query info (SQL level 2)
-set DBSLOG=0000010 Row action info
-set DBSLOG=0000020 Table action info
-set DBSLOG=0000040 Transaction info
-set DBSLOG=0000100 DBMS input/output data (SQL level 2)
-set DBSLOG=0000200 Admin file info (SQL drivers)
-set DBSLOG=0000400 DBMS SQL statements
-set DBSLOG=0001000 General debug statements
-set DBSLOG=0002000 Query processing info
-set DBSLOG=0004000 Data buffering info (communication)

Note: After startup DBSLOG can be set, raised or lowered with bshcmd:
-T "DBSLOG=value" set to value
-T "DBSLOG+value" add bits to current value
-T "DBSLOG-value" remove bits from current value

ahulikavi 12th May 2003 14:41

Thanks Omeluuk, I'll try tracing...

ahulikavi 14th May 2003 13:24

Problem Solved
 
I was finally able to solve the problem by using a table field for text name instead of an extern long variable

Before
Code:

extern long txt.name
t.no =  text.write( "txt.name", "2", kw1,kw2, kw3, kw4, "text", "text", tmp.file )

Now
Code:

t.no =  text.write( "tdsls040.txtb", "2", kw1,kw2, kw3, kw4, "text", "text", tmp.file )

Help says :
Quote:

The text_field, text_field_from, and text_field_to arguments must always contain a text field name. This name can be the name of a database field of type DB.TEXT, or it can be the name of a variable of type long. In both cases, the name must be enclosed by quote marks. When using a variable, this must be declared as EXTERN because the functions use the text_field argument indirectly to store the text number of the specified text. Database text field names are automatically declared as external.
Looks like only table field can be used ...


Thanks everyone for your help

OmeLuuk 14th May 2003 13:32

What was your declaration of txt.name?
Quote:

When using a variable, this must be declared as EXTERN because the functions use the text_field argument indirectly to store the text number of the specified text.
Should have been: "extern long txt.name"

zardoz 14th May 2003 15:40

I have just encountered this problem.
There is a bug :mad: or undocumented feature ;) in this function....

If the field name is a database field, the text is created in your own company, but if the field name is an external var the text is created in the company 0!

ahulikavi 15th May 2003 06:05

Thanks Zardoz !
 
You are right, texts were getting created, but in company 000. Omeluuk declaration was extern, anyways thanks to Zardoz this "feature" ;) has now been documented !!! (atleast on Baanboard)

alex.bonutti 4th September 2017 12:03

Hi all,
I'm developing a session extension with Tools 10.5 which should create and save a predefined text in purchase order footer. I've tried both via external variable or via database text field, text is created but I'm not able to commit the transaction and save it. I'm using DAL

ret = dal.change.object("tdpur400")
ret = dal.save.object("tdpur400")

or

ret = dal.change.object("tdpur400")
dal.set.field("tdpur400.txtb", text_nr)
ret = dal.save.object("tdpur400")

or even db update funtions

db.update(ttdpur400, db.retry)

but transaction cannot be completed with DAL error

Record ... cannot be saved in table Purchase Orders in company ...

If I commit just the text.write function, a text is correctly saved in the database, but it can't be linked to my entity (which is a purchase order). Can someone help me?

Thanks,
Alex


All times are GMT +2. The time now is 17:26.


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