Further investigation narrowed the problem on the Tdatabase class:
While saving on a Memo field:
- Code: Select all Expand view RUN
- prov:=""
FOR i:=1 TO 6
prov+=PADR(ALLTRIM(fill_in[i+236]),84)
NEXT i
msgstop(len(prov)) //504 as it should be
oDbf:trincheras:=prov
msgstop(len(oDbf:trincheras)) //still says 504 OK
.... //continue with other Memo fields
prov:=""
FOR i:=1 TO 6
prov+=PADR(ALLTRIM(fill_in[i+242]),84)
NEXT i
...
No apparent problem here, but the surprise comes when recovering the same field latter on:
- Code: Select all Expand view RUN
- msgstop(len(oDbf:trincheras)) //7 since the user choose to fill-in only seven space (correct), but, Where are my 504 characters saved? Field have been trimmed
FOR i:=1 TO 6
fill_in[i+236]:=SUBSTR(oDbf:trincheras,(i-1)*84+1, 84)
NEXT
msgstop(len(fill_in[237])) //still 7 since field has been trimmed unexpectedly
...
//same for ALL other memo fields
Fixed provisionally with an ending character like this, but this was not planned at all
- Code: Select all Expand view RUN
- prov:=""
FOR i:=1 TO 6
prov+=PADR(ALLTRIM(fill_in[i+236]),84)
NEXT i
oDbf:trincheras:=prov+"^" //mark end of field
msgstop(len(oDbf:trincheras)) //now we have 505 characters
prov:=""
FOR i:=1 TO 6
prov+=PADR(ALLTRIM(fill_in[i+242]),84)
NEXT i
oDbf:mediospase:=prov +"^"
...
//recover
msgstop(len(oDbf:trincheras)) //505 (forced by me)
FOR i:=1 TO 6
fill_in[i+236]:=SUBSTR(oDbf:trincheras,(i-1)*84+1, 84)
NEXT
msgstop(len(fill_in[237])) //now, 84 (user is happy again) only problem is that he has to go though all 7000 registers and save all of them to fix this. Now he is not happy at all (neither do I)
Is there a simple fix modifying something on the TDataBase class?
Thanks
Emiliano Llano Díaz