|
Home > Archive > dBASE Questions and Answers > September 2005 > How to convert memo to data in dbase file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to convert memo to data in dbase file
|
|
| shipchan 2005-09-20, 11:23 am |
| By using Dbase IV to write simple command, I try to count the no. of person named John as below :
count for name='John' to aa
the answer show in the screen of DOS ;
How to convert the memo to a structure field let say "aa"
Thank you
| |
| Ken Mayer [dBVIPS] 2005-09-20, 11:23 am |
| shipchan wrote:
> By using Dbase IV to write simple command, I try to count the no. of person named John as below :
> count for name='John' to aa
> the answer show in the screen of DOS ;
> How to convert the memo to a structure field let say "aa"
I have no idea what you're trying to do. What do you mean "convert the
memo ..."? A memo is data in a table. Are you trying to look for
information in the memo field?
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| shipchan 2005-09-20, 11:23 am |
| Ken Mayer [dBVIPS] Wrote:
> shipchan wrote:
>
> I have no idea what you're trying to do. What do you mean "convert the
> memo ..."? A memo is data in a table. Are you trying to look for
> information in the memo field?
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| shipchan 2005-09-20, 11:23 am |
| Ken Mayer [dBVIPS] Wrote:
> shipchan wrote:
>
> I have no idea what you're trying to do. What do you mean "convert the
> memo ..."? A memo is data in a table. Are you trying to look for
> information in the memo field?
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
Thank you for you promt reply.
I am trying to input the memo into structure field ; because when I
write "count for name='John' to aa"
the answer come out in the screen , how can I append the answer into thae structure field ? plase guide me to do. Thank you
Best regards
shipchan
| |
| shipchan 2005-09-20, 11:23 am |
| Ken Mayer [dBVIPS] Wrote:
> shipchan wrote:
>
> I have no idea what you're trying to do. What do you mean "convert the
> memo ..."? A memo is data in a table. Are you trying to look for
> information in the memo field?
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
Thank you for your prompt reply.
May I give more detail:
in DOS prompt
use schoolname
count for name = 'John' to aa
the answer show in the screen,
my problem is how that to "catch" th answer into data field structure.
Thank you !
| |
| Mervyn Bick 2005-09-20, 11:23 am |
| On Tue, 20 Sep 2005 17:49:33 +0200, shipchan <shipchan@yahoo.com> wrote:
.....[color=darkred]
> Thank you for your prompt reply.
> May I give more detail:
> in DOS prompt
> use schoolname
> count for name = 'John' to aa
> the answer show in the screen,
> my problem is how that to "catch" th answer into data field structure.
>
The number of Johns in the file schoolname has been stored on a memory
variable named aa. To capture that in a file USE the file that will hold
the number. Either go to a specific record or APPEND BLANK for a new
record and REPLACE nameno (or whatever the field is called) WITH aa. To
be of any use this file would probably also need the name to go with the
count. If so store the name to a variable, say, cMname and COUNT FOR
name = cMname to aa in the first step. In the second step REPLACE name
with cMname, nameno WITH aa.
Mervyn
--
The ns_ in my address is an attempt to thwart SPAM.
| |
| Ken Mayer [dBVIPS] 2005-09-20, 1:24 pm |
| shipchan wrote:
> Thank you for you promt reply.
> I am trying to input the memo into structure field ; because when I
> write "count for name='John' to aa"
> the answer come out in the screen , how can I append the answer into thae structure field ? plase guide me to do. Thank you
Something like:
count for name='John' to nCount
replace MemoFieldname with cCount
??
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| shipchan 2005-09-21, 9:24 am |
| Ken Mayer [dBVIPS] Wrote:
> shipchan wrote:
>
> Something like:
>
> count for name='John' to nCount
> replace MemoFieldname with cCount
>
>
> ??
>
> Ken
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
First of all I go to MS-DOS prompt to operate Dbase IV plus
I open a file "lottery.dbf" in command window at DOS
the structure field name="lotteryno" ; field type=CHARACTER
use lottery then
do *****.prg
(a simple programme to count the sum for lotteryno '1234'(character not numerial)
The command is as follow :
count for lotteryno='1234' to AA
then the answer would show in the screen "10" this means that there are 10set of 1234 content in the file lottery.dbf
my probelm is that how to "capture" the total "10" to become a data automatically without key in manually.Since 'AA' is a memory not a data ; so could not use the REPLACE command to capture in the field.
Kindly guide me, Thank you
Best Regards
Shipchan
| |
| shipchan 2005-09-21, 9:24 am |
| Mervyn Bick Wrote:
> The number of Johns in the file schoolname has been stored on a memory
> variable named aa. To capture that in a file USE the file that will hold
> the number. Either go to a specific record or APPEND BLANK for a new
> record and REPLACE nameno (or whatever the field is called) WITH aa. To
> be of any use this file would probably also need the name to go with the
> count. If so store the name to a variable, say, cMname and COUNT FOR
> name = cMname to aa in the first step. In the second step REPLACE name
> with cMname, nameno WITH aa.
>
>
> Mervyn
>
> --
> The ns_ in my address is an attempt to thwart SPAM.
First of all I go to MS-DOS prompt to operate Dbase IV plus
I open a file "lottery.dbf" in command window at DOS
the structure field name="lotteryno" ; field type=CHARACTER
use lottery then
do *****.prg
(a simple programme to count the sum for lotteryno '1234'(character not numerial)
The command is as follow :
count for lotteryno='1234' to AA
then the answer would show in the screen "10" this means that there are 10set of 1234 content in the file lottery.dbf
my probelm is that how to "capture" the total "10" to become a data automatically without key in manually.Since 'AA' is a memory not a data ; so could not use the REPLACE command to capture in the field.
Kindly guide me, Thank you
Best Regards
Shipchan
| |
| Ken Mayer [dBVIPS] 2005-09-21, 11:24 am |
| shipchan wrote:
> Ken Mayer [dBVIPS] Wrote:
>
>
>
>
> First of all I go to MS-DOS prompt to operate Dbase IV plus
>
> I open a file "lottery.dbf" in command window at DOS
> the structure field name="lotteryno" ; field type=CHARACTER
>
> use lottery then
> do *****.prg
> (a simple programme to count the sum for lotteryno '1234'(character not numerial)
> The command is as follow :
> count for lotteryno='1234' to AA
> then the answer would show in the screen "10" this means that there are 10set of 1234 content in the file lottery.dbf
> my probelm is that how to "capture" the total "10" to become a data automatically without key in manually.Since 'AA' is a memory not a data ; so could not use the REPLACE command to capture in the field.
> Kindly guide me, Thank you
Without your source code, I can't. The problem is that you're asking us
to help you modify a bunch of code that it sounds like you don't
understand. The COUNT FOR command, when using a TO option, should not be
displaying on the screen, which means something in your code is causing
this to display on the screen.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Mervyn Bick 2005-09-21, 11:24 am |
| On Wed, 21 Sep 2005 16:29:30 +0200, shipchan <shipchan@yahoo.com> wrote:
> First of all I go to MS-DOS prompt to operate Dbase IV plus
>
> I open a file "lottery.dbf" in command window at DOS
> the structure field name="lotteryno" ; field type=CHARACTER
>
> use lottery then
> do *****.prg
> (a simple programme to count the sum for lotteryno '1234'(character not
> numerial)
> The command is as follow :
> count for lotteryno='1234' to AA
> then the answer would show in the screen "10" this means that there are
> 10set of 1234 content in the file lottery.dbf
> my probelm is that how to "capture" the total "10" to become a data
> automatically without key in manually.Since 'AA' is a memory not a data
> ; so could not use the REPLACE command to capture in the field.
> Kindly guide me, Thank you
REPLACE fieldname WITH aa will store the value in aa, which is a memory
variable, to a field in the table open in the current workspace. First
though, you need a file in which to store the value as lottery.dbf would
not be the correct place for it. Set up an empty table with fields
lotteryno (character the same size as the field in lottery.dbf) and
lotcount(numeric say 4,0 but you will know best how big aa can possibly
be) called storenums
Consider changing ****.prg as follows
SELECT A
CLEAR
INPUT "Enter lottery number " TO cMlotno
USE lottery
...... the rest of your program as it is at present but change the COUNT
FOR to
...... COUNT FOR lotteryno = cMlotno TO aa
SELECT B
USE storenums
APPEND BLANK
REPLACE B->lotteryno WITH cMlotno,B->lotcount WITH aa,
CLOSE ALL
Mervyn
--
The ns_ in my address is an attempt to thwart SPAM.
| |
| shipchan 2005-09-22, 3:23 am |
| Ken Mayer [dBVIPS] ¼g¨ì:
>
> Without your source code, I can\\'t. The problem is that you\\'re asking us
> to help you modify a bunch of code that it sounds like you don\\'t
> understand. The COUNT FOR command, when using a TO option, should not be
> displaying on the screen, which means something in your code is causing
> this to display on the screen.
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
Enlcose attachment my *.dbf & *.prg
for your kind attention
| |
| Mervyn Bick 2005-09-22, 7:23 am |
|
> Enlcose attachment my *.dbf & *.prg
> for your kind attention
I don't have dBase IV so I can't run your program but I assume that it
works the way you want it to and your only problem is how to save aa to a
file which was your original query.
You started out by saving the first two counts to two variables, b00 and
a01, but after that you have used aa over and over again to hold a count
of different combinations of digits. Each time you use the value to
change the colour of an element on the sreen as well as display the actual
number as a string. This works because the whole screen is not cleared
after each count so the numbers and the coloured displays stay as each new
one is diplayed untill the screen is complete.
If you want to save each of these counts to a result file then you will
have to use a different variable to hold the result of each count. At the
end of your program you can then USE this results file, with records
having one field per count plus a field to hold the original file name, in
which to store these values.
Simply append a blank record and REPLACE the fieldnames with the variable
names
If you only ever run your program on one file, 4d95, which grows from time
to time then the results file need only have one record. You don't append
a blank record after the first time but simply replace the existing
values. (Check for a record and only if there isn't one append the blank.)
> aa=space(03)
Defining variables before you use them is a good habit but it is no
necessary in dBase. In this case you promptly go and store the result of
a COUNT to the variable which converts it to numeric! All you are doing
is confusing yourself.
> @ 04,01 SAY '00T='
> count for subs(no,1,2)='00'.or.;
..............
> @ 06,05 say LTRIM(str(a01))
> set colo to W+,bg,rb,gr+
There are many ways of doing things in dBase so there is no "right way" or
"wrong way". If it works it's OK. On the other hand programming style
can make the difference between a program being easy or difficult to
follow or change. Instead of copying and pasting mutiple copies of any
block of code longer then one or two lines I prefer to move them into a
UDF and pass the few bits that change in each block as parameters.
Mervyn
--
The ns_ in my address is an attempt to thwart SPAM.
| |
| shipchan 2005-09-22, 11:24 am |
| Message-ID: <B#4OLM4vFHA.1044@news-server>
Newsgroups: dbase.how-to
Lines: 5
Path: news-server
Xref: news-server dbase.how-to:628
NNTP-Posting-Host: dbase.com 64.132.211.168
Kindly be inform that 2 mentioned attached file (*.dbf & *.prg) can be operate in Microsoft Visual Foxpro 8.0 software.
Thank you
Best Regards
Shipchan
| |
| Mervyn Bick 2005-09-22, 11:24 am |
| On Thu, 22 Sep 2005 16:36:40 +0200, shipchan <shipchan@yahoo.com> wrote:
> Kindly be inform that 2 mentioned attached file (*.dbf & *.prg) can be
> operate in Microsoft Visual Foxpro 8.0 software.
Unfortunately I don't have VFP 8.0.
I can visulise WHAT you are doing and I have a fair idea of what your
output screen will look like without running the program but I have no
idea WHY you are doing it or what the output means. I quite honestly
don't have the time to try and work it out for myself.
In your original post you said that you wanted to save a memory variable,
aa, to a file. I gave you a pointer as to what to do but that was without
seeing your program. Now that you have posted the program I can see why
my original answer was not much help.
The problem to saving aa is that you use aa over and over to hold the
counts for different combinations of digits in the field you are
interested in. Only the last count, which is displayed in the bottom row
of column J as 99W=xx is available at the end of the program. You either
have to save each aa as it is generated (which is possible but which will
be a real pain with some messy programming) or you use 55 separate
variables to store the results and then you can easily write them all to a
file as the program ends. If this is not what you need then you are going
to have to explain the problem in more depth.
Mervyn
--
The ns_ in my address is an attempt to thwart SPAM.
|
|
|
|
|