?
Solved

Visual Foxpro access retrieve data memo fields

Posted on 2011-09-15
3
Medium Priority
?
2,774 Views
Last Modified: 2012-05-12
Normally I never use in my applications memo fields. Always had some issues to use them, namely because it was not clear to me the way i should write and read data in these containers.
I would like to know the way I should write and retireve data from Visual Foxpro memo fields
and what kind of data I can insert into them.
Thanks in advance for you help
0
Comment
Question by:luciliacoelho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 27

Accepted Solution

by:
CaptainCyril earned 1000 total points
ID: 36547224
I use memo fields to write lengthy values (more than 254 chars).
I also use memo fields to store Unicode text, RTF text and properties (ini files).
I used to store word documents, pictures, MS-Charts in memo fields only to display them in FRX Reports but now I store them outside the table and reference them from inside the table and the filenames are store in the memo fields.

To normally use memo fields
REPLACE table.memofield WITH cLongText
Thisform.editbox.Value = table.memofield

To store an object instance in a memo field use APPEND MEMO
APPEND MEMO notes FROM test.txt

To store General Fields: Pictures, Music Files, Charts, ...
CREATE TABLE MyGenTbl (mygenfield G)
APPEND BLANK  && Add a blank record
APPEND GENERAL mygenfield FROM C:\EXCEL\BOOK1.XLS CLASS EXCELCHART

If you are using some DBF readers or database connections, you might have problems reading and writing from memo fields.

If you use COPY TO sheet.xls TYPE XLS it will not export memo contents. You will have to do that via Excel Automation.
0
 
LVL 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1000 total points
ID: 36548965
A normal memo is like a larger textfield, so you read and write to it like to a normal char field.
Cyril already discussed some other commands special to memos, but you don't need APPEND MEMO, it's just another possibility. You could also read in a file via FILETOSTR() and then store that as you store a value coming elsewehere into a char field. From that perspective it's as easy to use and maintain as any char field.

The difference is in how VFP displays memo contents. Simply use an editbox instead of any other control, and you get the memo content directly displayed instead of "memo" or "Memo", which is what foxpro displays in a textbox or a default grid column.

Another difference Cyril already told is the handling of memos in COPY TO and also EXPORT.

And yet another difference is, you can't GROUP BY memo fields in SQL, and you can't also SELECT DISTINCT with a memo field in the field list. I can only guess the machnisms doing these kind of sql operations need same size values and VFP would need to pad all memos to the same maximum length for that, which was considered as a bad thing performancee wise, so instead this was handled as forbidden, there may also be a size limit as the one for normal char fields.

There are some special memo field types, if talking about memo as a term for all field types stored in an fpt file, namely blob and general field. I'd avoid general in general, and blob is for storage of files, a special feature is you can set an image control pictureVal property to a blob field and let it display as picture, valid for images stored in blob, that foxpro can display, but it's easier and better to not put files into tables anyway.

Additional to that there is memo (binary), but that is also a form of field modification you have for other field types, eg char (binary). This simply means storage is not for a certain codepage and putting in values does neither check any codepage nor make any conversion, data is stored 1:1

Memo is convenient for larger portions of text, especially multi line. I mainly use it for comment/remark fields with less important data, that nevertheless will perhaps help to store some instructions of other short text passages.
I also sometimes use it for paths, as those can get longer than 254 chars. But I mainly use it for larger texts, not even for rtf, which is not wrong, but plain text without more formatting attributes is okay for my user base.

Bye, Olaf.
0
 

Author Comment

by:luciliacoelho
ID: 36553334
Thank you Olaf and Ciryl for your information. i'm going to try your  helpful advises
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question