Page 1 of 4
The problem with MEMO
Posted: Tue Apr 17, 2018 5:32 am
by Eugene Lutsenko
I used a text field of type "C" in the database. Then it turned out that sometimes the length of the field in 255 characters is not enough, ie need more. Then I replaced "C" with "M" and the program stopped working. In the program I didn't change a thing. When you change back "M" to "C", the program starts working correctly again. Has anyone come across anything like this?
Maybe it doesn't work:
Code: Select all
REPLACE Filtr WITH IF(AT(aClust1[cl], ALLTRIM(NAMECLS_FU)) > 0, '#', '')
Are there any peculiarities in the handling of memo fields in comparison with text fields?
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 7:21 am
by rdonnay
What kind of information are you storing in the memo field?
How did you create the memo field?
Did you use dbCreate()?
There are 2 types of memo fields in FoxDbe:
{ 'MEMO', M, 10, 0 }
{ 'MEMO', M, 4, 0 }
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 8:16 am
by Eugene Lutsenko
Code: Select all
aStructure := { { "Num_it" , "N", 15, 0 }, ;
{ "Num_pp" , "N", 15, 0 }, ;
{ "NameCls1" , "C", 255, 0 }, ;
{ "NameCls2" , "C", 255, 0 }, ;
{ "KodCl_old1" , "N", 15, 0 }, ;
{ "KodCl_old2" , "N", 15, 0 }, ;
{ "NameCls_Sh" , "C", 255, 0 }, ;
{ "NameCls_Fu" , "M", 10, 0 }, ; // Мемо-поле. Почему-то не работает "M", 10, 0
{ "Ur_sxod" , "N", 15, 7 }, ;
{ "Ur_razl" , "N", 15, 7 }, ;
{ "Ur_razlIsh" , "N", 15, 7 }, ;
{ "Normalizat" , "C", 15, 0 }, ;
{ "KodCl_new" , "N", 15, 0 }, ;
{ "Hierarchy" , "N", 15, 0 }, ;
{ "Filtr" , "C", 1, 0 }, ;
{ "X_koord" , "N", 15, 7 }, ;
{ "Y_koord" , "N", 15, 7 } }
mNameTree = 'Tree-'+STRTRAN(STR(mNumMod,2),' ','0')
DbCreate( mNameTree, aStructure )
But perhaps M should not be in quotes: "M"?
And what is the difference between these two types of memo fields?
I treat a memo field the same way as a text field, because it contains text.
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 8:42 am
by rdonnay
{ "NameCls_Fu" , "M", 10, 0 }, ; // Мемо-поле. Почему-то не работает "M", 10, 0
Try this:
{ "NameCls_Fu" , "M", 4, 0 }, ; // Мемо-поле. Почему-то не работает "M", 4, 0
This stores text as binary.
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 9:13 am
by Eugene Lutsenko
Tried. The result is exactly the same as it was. When using a simple text field: { "NameCls_Fu" , "C", 255, 0 } everything works fine as long as its length is enough. The values in this field consist only of characters: (),0123456789, for example:
(((2,(3,(7,(11,13)))),(1,(29,(23,(17,19))))),((6,(21,(18,(9,27)))),(30,(10,(15,(5,25))))))
You can use a simple text file with lines of the following form, which can be written and read using the commands of the memo group:
MemoEdit()
MemoLine()
MemoRead()
MemoTran()
MemoWrit()
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 10:37 am
by rdonnay
Put this in your code:
WTF Namecls_fu, Len(Namecls_fu)
Compare the results to see if a different value is returned.
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 1:02 pm
by Eugene Lutsenko
The values in this field are correct:
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 2:17 pm
by Eugene Lutsenko
This is necessary to remove the limit on the number of clusters in the mode:
http://aidos.byethost6.com/ClustClass/page_01.htm
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 2:36 pm
by rdonnay
The values in this field are correct:
If the values are correct, then it should work.
I don't believe that the values are correct.
Your memo field may have a terminating character that you cannot see.
Sometimes this is a Chr(0) or a Chr(26) character.
This is why you should compare the LENGTH of each string (after the Alltrim()).
Re: The problem with MEMO
Posted: Tue Apr 17, 2018 4:27 pm
by Auge_Ohr
Eugene Lutsenko wrote:Then I replaced "C" with "M" and the program stopped working. In the program I didn't change a thing. When you change back "M" to "C", the program starts working correctly again.
how do you change Type "C" to "M" ?
create new DBF or using DBU etc ?
what Type of DBF are you using ? DBFNTX oder FOXCDX ?
how have you transfer old "C" Value into "M" Memo ?