Subject: | Re: Stack Overflow
| Date: | Tue, 20 Aug 2019 12:53:39 -0500
| From: | Mark Bannister <markRemove@THISinjection-moldings.com>
| Newsgroups: | pnews.paradox-development
|
Just an FYI on this type of thing. I intercept all paste operations and
send them through a "Clean String" method that takes out low ascii and
characters that the table can't accept. It's very OLD code so not very
well written.
method cmCleanStringAlphaST (
stdata String ;data to add to field
stfield
, var mytc TCursor ;tc to
add data to
, stField String ;field to check for
valid data
, loRemoveLowAscii logical ;// default
false -- will remove line breaks
, loPreserveLineBreaks logical
, loPreserveTabs logical ;// horizontal
only vertical will be removed
, loxtrim logical ;// trim spaces on
front and back
) String
;This is to avoid the "invalid table language" error and
similiar
;removes invalid characters and concats string to correct length
;and error will occur if mytc does not contain any records!!!
;THERE IS AN ERROR with ISVALID !!!!!!!!!!!!!!
;it allows low byte characters although table repair does
not like them !!!
;// will trim to size of the field
;// will remove 127 Delete
;
var
answer Logical
stnew
, stch
, st1
, st0
, st9
, st8 String
siLen smallint
loOK Logical
i LongInt
langtc tcursor
stCharsToRemove string
loMemo logical
endVar
try
;now get all valid characters that we can
stnew = ""
siLen = mytc.fieldsize ( stfield )
; if mytc.FieldType(stField) = "MEMO" or
mytc.FieldType(stField) = "FMTMEMO" then
loMemo = mytc.FieldType( stfield ) <> "ALPHA"
; getlanguagedriver
st1 = ""
if NOt cmLanguageDriverTable( mytc, langtc ) then
fail(UserError+4,"")
endif
stCharsToRemove = chr(127) ;// delete
if loRemoveLowAscii then
stCharsToRemove = ""
for i from 1 to 31
if ( loPreserveLineBreaks and i=10)
OR ( loPreserveLineBreaks and i=13)
OR ( loPreserveTabs and i=11) ;vertical tab
OR ( loPreserveTabs and i=12) ;/
horizontal tab
then
;// don't remove these chars
else
;// remove this char
stCharsToRemove = stCharsToRemove + chr(i)
endif
endfor
endif
;// remove 127
stData = removeChars(stdata,stCharsToRemove)
for i from 1 to stdata.sizeex ( )
stch = stdata.substr ( i , 1 )
;st1 = st1 + stch
try
if NOT langtc.qlocate( ansicode(stch) ) then
loOK = False
; fail ( USerError , "" )
else
loOK = true
endif
onFail
errorclear ( )
loOK = false
endTry
if loOK then
stnew = stnew + stch
endIf
;// if we silen is the size of the field
if stnew.sizeex ( ) = silen and NOT loMemo then
quitLoop
endIf
endFor
if loXtrim then
stnew = rtrim(stnew.ltrim())
endif
answer = true
; mytc.isvalid(sifield,stnew)
langtc.close()
onFail
errorShow ( "cmCleanStringAlphaST" )
answer = false
if langtc.isassigned() then
langtc.close()
endif
endTry
return ( stNew )
EndMethod
method cmLanguageDriverTable(var sourcetc tcursor,
var langtc tcursor ; returns the language
table we need
) logical
var
stlang string
lonew logical
mytbl table
li1 longint
loanswer logical
endvar
try
stlang = sourcetc.getlanguagedriver()
lonew = false
try
if not langtc.open(":priv:__Valid1_"+stlang+".db") then
fail(UserError+1,"")
endif
onfail
errorclear()
lonew = true
endtry
if lonew then
;make the language table
mytbl = create ":priv:__Valid1_"+stlang+".db"
WITH
"ID" : "I"
,"Mychar" : "A1"
LanguageDriver stlang
Key "ID"
endcreate
sleep()
if not langtc.open(":priv:__Valid1_"+stlang+".db") then
fail(UserError,"Could not open language table in library
strings.cmlanugagedrivetrable")
endif
langtc.edit()
for li1 from 1 to 255 ;// start at 32 if you want to exclude low
ascii chars
langtc.insertRecord()
langtc."ID" = li1
try
langtc."mychar" = chr(li1)
langtc.unlockRecord()
onfail
errorclear()
langtc.canceledit()
langtc.edit()
endtry
endfor
langtc.endedit()
endif ;new table
loanswer = true
onfail
errorshow("Could not create language table in library
strings.cmlanugagedrivetrable")
loanswer =false
;fail(UserError,"Could not create language table in library
strings.cmlanugagedrivetrable")
endtry
return loanswer
endMethod
On 8/20/2019 11:46 AM, Steven Green wrote:
> so this was a big wabbit hole, still trying to figure it out completely
>
> first off, indexes
>
> INDEX MAINTAINED, single field, still makes an X0* file.. multi-field
> and/or CASE INSENSITIVE, it makes an XG* file.. I guess we're all
> supposed to still know that :-)
>
> second, changing the index type didn't fix this problem.. all three
> reproducible GP errors point to values past the end of the index values
> of the linked table, which is what made me notice the old indexes, but
> the bottom line on that linked table is still "invalid formatted memo
> header".. make that go away, everything else is fine
>
> so today's experiment is changing the two F fields to M fields.. we'll
> see.. but in another related scenario in that app, losing the F will
> lose some critical BOLD paragraph headers.. so we're still trying to ID
> whatever it is in the F fields that allows the data in the field but
> causes the table failure
>
> --
>
> Steven Green
> Myrtle Beach, South Carolina, USA
>
> http://www.OasisTradingPost.com
>
> Collectibles and Memorabilia
> Vintage Lego Sets and Parts
> - and Paradox support, too
> "Steven Green" wrote in message
> news:5d4ad422$1@pnews.thedbcommunity.com...
>
> wow.. haven't seen that expression in a long time
>
> tableframe in a form.. get the stack overflow when using Record / GoTo /
> Last (Ctrl-F12).. don't get it interactively on the raw table..
>
> same table I reported here the other day, with the unexpected filter
> behavior.. table has been rebuilt and packed regularly, always.. I'm gonna
> do some testing, but I don't have a clue
>
> --
>
> Steven Green
> Myrtle Beach, South Carolina, USA
>
> http://www.OasisTradingPost.com
>
> Collectibles and Memorabilia
> Vintage Lego Sets and Parts
> - and Paradox support, too
|