Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Text merging doubled when returned from function,how to fix?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Text merging doubled when returned from function,how to fix?
Miscellaneous
Thread ID:
00901756
Message ID:
00901756
Views:
38
Hi, All,

I have two functions:
*merging
function getlettercaption 
 lparameters lpnscript_id
 local lcreturn
 use scriptfile in 0 order script_id shared 
 if indexseek(m.lpnscript_id,.t.,'scriptfile','script_id') ;
 then 
  m.lcreturn = textmerge(alltrim(scriptfile.mg_script))
 else
  m.lcreturn =[]
 endif 
 use in scriptfile 
 return m.lcreturn
endfunc &&getlettercaption 

* get default caption 

function getdefaultcaption
 use sysfile in 0 shared 
 local m.lcreturn
 m.lcreturn = getlettercaption(sysfile.dft_cap)
 use in sysfile 
 return m.lcreturn 
endfunc &&getdefaultcaption
Then I have a prg which calls function getdefaultcaption() like as follows:
set textmerge on 
LOCAL lcfile
m.lcfile = SYS(2015)+".txt"
_text = FCREATE(m.lcfile)
SET TEXTMERGE ON 
TEXT noshow
*some code
<<getdefaultcaption()>>
*some more code
ENDTEXT
The end result was that I get two lines of letter caption instead of one, for example,
I get:

LLL Company
2324 Main St.
Main City, CA 90000

Dear Mr. John Doe,

LLL Company
2324 Main St.
Main City, CA 90000

Dear Mr. John Doe,


Instead of just:

LLL Company
2324 Main St.
Main City, CA 90000

Dear Mr. John Doe,

Does anybody know why this is happening? How should I fix this?
Any help will appreciated!

TIA,

Dawa
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Next
Reply
Map
View

Click here to load this message in the networking platform