Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textmerge failing in VFP 9 SP2

Status
Not open for further replies.

Pollock

Programmer
Jun 2, 2000
49
CA
I am using textmerge in an application. In vfp 8 it works fine. I recompile the application in vfp 9 SP2, and during any process when I am using set textmerge, if a macro substituted command like "use database!remoteview" fails, the textmerge loses connection to file and no new entries are posted to the file. The value of _text when an error occurs goes to -1. Just wondering if anybody has seen this/found a solution
 
What's the code you're using? Are you setting _TEXT to a filehandle you received from FCREATE() and did that successfully create that file? Or are you using SET TEXTMERGE TO Filename?

Is the phenomenon perhaps rather a network failure, and that is the reason both the opening of a remote view AND the textmerge output to a file fails?

I never heard of a conjunction of these two things. VFP does most certainly manage file handles to dbfs and other outputs like textmerge in one central place in it's runtime, but I don't think that USE of a dbf or view and SET TEXTMERGE TO Filename or FCREATE() would influence each other or crash one another. It's more probable you're hitting a central problem of network failure and so both remote view usage and textmerging to a file would break at the same time. Coincidence does not necessarily mean causality.

I don't know if you're really outputting textmerge to a LAN file. Perhaps changing this to go into GETENV('TEMP') and then finally copying the result where it should be created would help.

And you may change code to using the Textmerge() function or TEXT To Variablename .. ENDTEXT and then output the resulting string variable via StrToFile().

Bye, Olaf.
 
I am setting the _text value via SET TEXTMERGE TO (filename). And it is a consistant failure. This is the second work around I have had to come up with.
 
a macro substituted command like "use database!remoteview"

I don't have an answer for your immediate problem. But you should never use a macro for a command that involves a path. That's a recipe for errors. Use name substitution instead. That is, if you have a variable cTable containing the table name with path, instead of:

Code:
* NEVER do this
USE &cTable

do it like this:

Code:
USE (m.cTable)

That way, if there's a space in the path or filename, it'll work.

Tamar
 
I did finally come up with a similair solution, as it seems quite a few kind of errors can set the _text to -1. My solution was to isolate code that could generate error. Prior to code execution, store the file handle contained in _text to a variable, and right after, check to see if _text was -1, if so, reset it to the store variable.
 
Oh I see, that was new to me. I always use the Textmerge() function or TEXT..ENDTEXT with variables and never to text files, even if I finally write out to texts. But typically this is for generating SQL to use in cursoradaptor or SQLExec(). Or via mail.

Bye, Olaf.
 
Confirm.

I have a similar issue. No path involved. Examining the first 10 records in multiple dbfs in a for loop. I use macro substitution in the scatter command in a method. As soon as the command executes, the textmerge file closes.

I am opening the textmerge file like so.

SET TEXTMERGE TO "pkeyfiles.txt"
SET TEXTMERGE ON NOSHOW

The work around I am using is to open the file again each time before I write to it.

SET TEXTMERGE TO "pkeyfiles.txt" ADDITIVE

Thanks.
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top