Page Index Toggle Pages: [1] 2 3 4 Send Topic Send Topic Print Print
Very Hot Topic (More than 25 Replies) MergeFilePrint() Questions (Read 10106 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
MergeFilePrint() Questions
Jul 19th, 2007 at 9:13pm
Print Post Print Post  
I am confused (Yes once again)

Does an element name (amount of letters contained) affect how it merges with MergeFilePrint() ?

I have numerous name.Rtf files created and working well for my merge needs. My problem is when I am creating the original master RTF merge document it is often hit and miss if the data will display. Often it seems to occur when an element name is larger.

I can copy a perfectly working RTF file, rename it a new RTF file name and run it, it merges fine. I then open the RTF file change an element name. In my example I change PropertyFirst (the name of the property owner) to PropertyPODContactFirst (the name of the Pay off Demand company contact) and it will not work.

Often if I change my element name to something short it works.

I have messed with the folding digit and opening in notepad and manually editing the line but that creates all sorts of other issues for me.

Has anyone else seen this behavior using MergeFilePrint() ?

Has anyone had problems getting certain elements to merge when they try to create a MergeFilePrint() document ?

Thanks
« Last Edit: Mar 19th, 2008 at 9:04pm by Hammer »  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: MergeFilePrint() frustration.
Reply #1 - Jul 19th, 2007 at 9:33pm
Print Post Print Post  
I know this is probably a silly question, but I have to get it out of the way.
Are you certain you are spelling the element name correctly?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: MergeFilePrint() frustration.
Reply #2 - Jul 19th, 2007 at 9:53pm
Print Post Print Post  
Hammer wrote on Jul 19th, 2007 at 9:33pm:
I know this is probably a silly question, but I have to get it out of the way.
Are you certain you are spelling the element name correctly?


Silly questions fit me well.  Smiley Unfortunately that is not the problem in this case.

I often times f5 in the name box of the property editor and copy this data and paste into my [[  ]]  (on a side note right clicking in the property editor field offers a choice of Grab Current Value- once grabbed how do I paste this? Ctrl V does not work)

Thanks

  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: MergeFilePrint() frustration.
Reply #3 - Jul 20th, 2007 at 1:54am
Print Post Print Post  
BOBSCOTT wrote on Jul 19th, 2007 at 9:53pm:
(on a side note right clicking in the property editor field offers a choice of Grab Current Value- once grabbed how do I paste this? Ctrl V does not work)

That is simply doing the exact same thing as pressing the F5 key. It's doesn't place the value in the Windows clipboard. Try it while the Name field in Property Editor is empty (and an LE is selected), and you will see that it fills in with the name of the LE.

To copy the value, you need to use Ctrl-C, or select Edit Long Value, then use the right-click Copy selection from that editor window.

It would be nice, though, if that little popup menu had the normal Cut, Copy, Paste... type choices available at the Property Editor level, rather than only in the popup editor window.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: MergeFilePrint() frustration.
Reply #4 - Jul 20th, 2007 at 2:36pm
Print Post Print Post  
Quote:
That is simply doing the exact same thing as pressing the F5 key


Thanks Carl,

I use the f5 feature all the time. I find it to be one of the handiest little features. My interpretation of grab current value was different then its actual intention. I was thinking once I f5 to retrieve the value write clicking on grab current value meant it wood cut it to a clipboard saving me my ctl c ctrl v steps.  No biggie!

Now does no other responses mean I am the only one who is having a problem with some elements and MergeFilePrint ?

Everyone else just sticks the [[ brackets around the element name and all is well?

Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: MergeFilePrint() frustration.
Reply #5 - Jul 20th, 2007 at 2:56pm
Print Post Print Post  
BOBSCOTT wrote on Jul 20th, 2007 at 2:36pm:
Now does no other responses mean I am the only one who is having a problem with some elements and MergeFilePrint ?

Everyone else just sticks the [[ brackets around the element name and all is well?


Is there one that always fails that we can try/look at?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: MergeFilePrint() frustration.
Reply #6 - Jul 20th, 2007 at 3:07pm
Print Post Print Post  
Hammer wrote on Jul 20th, 2007 at 2:56pm:
Is there one that always fails that we can try/look at?


Sure. I will send tech support my app, 2 rtf files 1 that works everytime and 1 with only 1  element that does not. I will attach directions on the steps I use.

Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: MergeFilePrint() frustration.
Reply #7 - Jul 20th, 2007 at 3:48pm
Print Post Print Post  
Thanks Robert, I'll have a look at it as soon as possible.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: MergeFilePrint() frustration.
Reply #8 - Jul 24th, 2007 at 2:02pm
Print Post Print Post  
Just a Followup:

Roberts problem turned out to be that the ['s and ]'s were set as one font Face and size and the name of the element was set as another font face and size. When viewed as plain text it looked something like this /fontstatement[[/fontstatementPropertyPODContactFirst/fontstatement]]

It was fixed by selecting the entire Merge Field and setting the font size and face on it.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: MergeFilePrint() frustration.
Reply #9 - Mar 14th, 2008 at 12:47pm
Print Post Print Post  
Hello!

I use [[AddressBlock]] tag in the merge doc in place of individual merge fields
to handles a blank-linesin-the-address-block problem.  And
Replace [[theDate]] merge tag with current formal date  [[Datum]] merge tag
also inserts the current date in the doc.

Since the original RFT-File after the start of the MergeFilePrint is changed. I try to do a copy from the original before the start from it over Shell. Unfortunately, the Shell runs - command not correct. I make one for mistake here surely.


Thanks for the help.

Dr. Belhareth


hier is Batch file:
c:
cd\
C:\sesame2\docs\rft
copy %1  %2
exit



MergePrintFile Code:

ar vTypeFiles as String      // Files of specified type (file extension)
var vSelectedFile as String // Selected file
var n as Int                       // Loop counter
var vDoc as String
var vAddressBlock as String
var vOutputAddressBlock as String
var vResult as String
var vDatei as String
var vDateiKopie as String


PopupSelectPosition(4, @XPos(ThisElement),@YPos(ThisElement))
vPath = "C:\Sesame2\DOCS\RFT"

vType = @Popupmenu(".txt;.doc;.pdf;.htm;.rtf","SELECT FILE")

vAllFiles = @LocalListDirectory(vPath)

For n = 1 to @CountStringArray(vAllFiles)
If @Right(@AccessStringArray(vAllFiles, n), 4) = vType
Then
vTypeFiles = @AppendStringArray(vTypeFiles,@AccessStringArray(vAllFiles, n) )
Next

vTypeFiles = @SortStringArray(vTypeFiles, 0)
vSelectedFile = @PopupChoiceList(vTypeFiles, vPath + "\*" + vType)
vDatei = vPath + "\" + vSelectedFile
@Msgbox("Selected file:","",vDatei)
PopupSelectPosition(0, 0, 0)

vDateiKopie =  vPath + "\2" + vSelectedFile

(??)  n = @AsynchShell("C:\sesame2\copy.bat " + vDatei + " " + vDateiKopie)

// This program uses an [[AddressBlock]] tag in the merge doc
// Read in the rtf merge doc
vDoc = @Insert(vDateiKopie)

// Compile the address block
vAddressBlock = Vorname + " " + NachName + @NL() + Firma +@NL() + Add1 + @NL() + Add2 + @NL() + Plz + ", " +  Ort

// Replace [[theDate]] merge tag with current formal date
vDoc = @Replace(vDoc, "[[Datum]]",@Dom(@ServerDate()) + "." + @Month$(@ServerDate()) + "."+ @Year(@ServerDate()) )

// Collapse any blank lines in address block
vAddressBlock = @Replace(vAddressBlock, @NL() + @NL(),@NL())

// Loop thru the address block and precede each remaining
// line with the rtf "\par" tag for a new paragraph

SetStringArraySeparator(@NL())
For n = 1 to @CountStringArray(vAddressBlock)
vOutputAddressBlock += "\par " + @AccessStringArray(vAddressBlock, n) + @NL()
Next

// Replace the merge doc tag with the reconstituted address block
vDoc = @Replace(vDoc, "[[AddressBlock]]", vOutputAddressBlock)

// vresult = "Myresult"
If FileExists("C:\Sesame2\Myresult.rtf")  then  FileDelete("C:\Sesame2\Myresult.rtf")

// Write output file
FileOverwrite(vDateiKopie, vDoc)

     MergeFilePrint(vDateiKopieNeu, "rtf", "", "", "", "Myresult", 0)
           n = @AsynchShell("Myresult.rtf")
« Last Edit: Mar 16th, 2008 at 11:43am by Amor »  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: MergeFilePrint() frustration.
Reply #10 - Mar 15th, 2008 at 1:40am
Print Post Print Post  
Quote:
Since the original RFT-File after the start of the MergeFilePrint is changed.

Actually, that is not accurate. The original RTF file is not changed by Sesame. It simply reads the original file into memory, and writes the changes out to a different file. For example, in the following code sample, "Document.rtf" is read into memory, then the modified output is written to "Result.rtf" (the .rtf file extension is omitted because Sesame will use the extension specified in the extension parameter).

Code
Select All
MergeFilePrint("Data\Document.rtf", "rtf", "", "", "", "Data\Result", 1) 





Hmmm... Now that I've looked through your code, I realize that I may have misunderstood what you meant in the statement above.

I see that you are modifying the original RTF file before MergeFilePrint() has a chance to read it. There is another way to handle the AddressBlock.

The documentation indicates that the 5th argument (called "matches") allows us to "match" the merge field names appearing in the merge file with the element names on the form. What is doesn't tell us, is that you can also "match" a merge field name with a variable.

So, rather than modify the RTF document, you should be able to use something like the following:
Code
Select All
MergeFilePrint(vDateiKopieNeu, "rtf", "", "", "AddressBlock=vOutputAddressBlock", "Myresult", 0) 



BTW, I see you already found out that MergeFilePrint() will not overwrite an existing file, so you definately do need to keep using this:
Code
Select All
If FileExists("C:\Sesame2\Myresult.rtf")  then  FileDelete("C:\Sesame2\Myresult.rtf") 

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: MergeFilePrint() frustration.
Reply #11 - Mar 17th, 2008 at 9:49pm
Print Post Print Post  
Hello Carl!
I can ´t  "match" a merge field name with a variable.
MergeFilePrint hier  does not work:

MergeFilePrint(vDatei, "rtf", "", "", "AddressBlock=vOutputAddressBlock", "Myresult", 0)

Thanks.

Dr. Belhareth
« Last Edit: Mar 18th, 2008 at 10:41am by Amor »  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: MergeFilePrint() frustration.
Reply #12 - Mar 19th, 2008 at 1:40am
Print Post Print Post  
Sorry about that.  Embarrassed    The variable must be outside of the quotes.  Roll Eyes


The correct syntax is like this:
Code
Select All
MergeFilePrint(vDatei, "rtf", "", "", "AddressBlock=" + vOutputAddressBlock, "Myresult", 0)  



Be sure to let me know if this works - it should.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: MergeFilePrint() frustration.
Reply #13 - Mar 19th, 2008 at 1:15pm
Print Post Print Post  
Hello Carl!
Thanks for the support.
Your proposal runs good, but unfortunately I get shut only the first line of the AddressBlocks !

My code :

/ / Compile the address blocks
vAddressBlock = first name" + " + last name + @NL() + company + @NL() + Add1 + @NL() + Add2 + @NL() + country" + " + Plz" + " + place
/ / Collapse any brightly lines in address blocks
vAddressBlock = @Replace (vAddressBlock, @NL() + @NL(), @NL() )

/ / Loop thru the blocks address and precede each remaining
// line with the rtf "\par" tag to signify new paragraph
SetStringArraySeparator(@NL())
For n = 1 to @CountStringArray(vAddressBlock)
vOutputAddressBlock += "\par " + @AccessStringArray(vAddressBlock, n) + @NL()
Next

If FileExists("C:\Sesame2\Myresult.rtf") then  FileDelete("C:\Sesame2\Myresult.rtf")

vMatches = "AddressBlock=" + vOutputAddressBlock
  MergeFilePrint(vDatei, "rtf", "", "", vMatches,"Myresult", 0)
           n = @AsynchShell("Myresult.rtf")


Thanks.
Dr. Belhareth
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: MergeFilePrint() frustration.
Reply #14 - Mar 19th, 2008 at 2:27pm
Print Post Print Post  
Yes, I see what you mean.

I've never tried to use multiple lines in the same variable before, but I just worked it out now.

This is the general template that works properly. It only requires one variable and no loops.
Code
Select All
var vAddressBlock as string

// Build address block
vAddressBlock = LE1 + @NL() + LE2 + @NL() + LE3

// Remove blank lines
vAddressBlock = @Replace(vAddressBlock, @NL() + @NL(), @NL() )

// Insert RTF paragraph tags
vAddressBlock = @Replace(vAddressBlock, @NL(), "\par " + @NL())

// Delete existing output file because MergeFilePrint will not overwrite files
If FileExists("Data\result.rtf")
	FileDelete("Data\result.rtf")

// Merge data with document
MergeFilePrint("Data\Document.rtf", "rtf", "", "", "Address1=" + vAddressBlock, "Data\result", 1)
 



  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 3 4
Send Topic Send Topic Print Print