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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memo field - space is causing problem

Status
Not open for further replies.

1421

Technical User
Feb 24, 2004
69
HI ALL!
Despite my 20+ Dbase/Foxpro years, I never worked with memo fields, please excuse if question is 'oversimple'. I am initializing a memo field with a Replace command & getting mixed results, sometimes a space is causing the data to go to the next 'mline()' & sometimes not. My question is: what is the best way to move data into a memo field & then retreive it (after the user has updated it)? I did do 'set memowidth' to the correct length. I am using VFP Ver 9.

Thank You

 
I'n not sure I understand the problem. You can treat a memo field pretty well the same as a character field. So you can do:

Code:
REPLACE MyMemo WITH SomeCharacters

and you can equally say:

Code:
MyCharVariable = MyMemo

What exactly do you mean when you say: sometimes a space is causing the data to go to the next 'mline()'

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
OK, this is the code: I have a file called abc.dbf with 1 field called aaa type=memo.
.............................
CLEAR
use abc
L1='line #1'+repl('a',50)+'END'
L2='line #2'+repl('a',50)+'END'
L3='line #3'+repl('a',50)+'END'
set memowidth to 60
Replace aaa with l1+l2+l3
?mline(aaa,1)
?
?mline(aaa,2)
?
?mline(aaa,3)
..............................
The results of this code is
Line

#1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaENDLine

#2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaENDLine

===========================================================

Now when I change the code, by eliminating a space, as follows;
.............................
CLEAR
use abc
L1='line.#1'+repl('a',50)+'END'
L2='line.#2'+repl('a',50)+'END'
L3='line.#3'+repl('a',50)+'END'
set memowidth to 60
Replace aaa with l1+l2+l3
?mline(aaa,1)
?
?mline(aaa,2)
?
?mline(aaa,3)
..............................
The results of this code is
Line.#1aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaEND

Line.#2aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaEND

Line.#3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaEND

The way it should be. So what am I doing wrong?

Thank You
 
You're not doing anything wrong.

In your first piece of code, the first "word" is 'line' and the second is '#1'+repl('a',50)+'END'+ 'line'. Together, that's too big for the 60-character line, so VFP splits it at the space (which is the fifth character). The remaining 59 characters can just fit on the line. So you then get a carriage-return to split the line, and another because you are as the 60-character limit. That's why there's a blank line in the output.

In other words, what you are seeing is exactly what you would expect to see.

I'm not quite sure exactly what you are trying to achieve, but why don't you set the memowidth to 62, the insert this text:

L1='line #1'+repl('a',50)+'END'
L2='line #2'+repl('a',50)+'END'
L3='line #3'+repl('a',50)+'END'
Replace aaa with l1+chr(13)+l2+CHR(13)+l3

I would think this will give you what you want.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
HI

When you say L1+L2+L3, all the characters in the variables are added without a space between them.

Imagine a text editor with word wrap on. Then type in the contents of L1+L2+L3. Then change the window size to different widths. What happens to the text. The same thing happens to memo field also. Since the space between the words happen to be after 'Line' and L2 continues with L1 without space.. the result is L1is last word and L2s first word merge to act as one word, you get the result.

Irrespective of memowidth, this effect will take place. If you insert a carriage return between two lines, then there will be a line break. However, still depending on the memo windows width, the text may wrap as per the length.

If your intention is to see the lines differently whenever there is a carriage return, then try ALINES() instead of MLINE.

ALINES is not affected by SET MEMOWIDTH.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Thanx all, as mentioned before I never worked with memo fields, but I just realized that I can use it for my purposes & i dont need any parsing, as i can also print it using the 'stretch' option.

Thank You All
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top