delete_row() with spaces in key (OpenInsight Specific)
At 14 NOV 2001 06:48:12PM Wilhelm Schmitt wrote:
How do I delete a row, which has spaces in the key - in OI?
delete_row() will not do the job.
Wilhelm
At 14 NOV 2001 09:13PM Richard Hunt wrote:
Delete_row() works for me with a key of "ONE ONE".
I used the RUN DELETE_ROW "FILE_NAME","ONE ONE",0 and that worked.
I used the following in a window event script…
DECLARE SUBROUTINE DELETE_ROWFILE_NAME=TEST"DELETE_ROW(FILE_NAME,ID,0)and that worked too.
At 15 NOV 2001 12:29PM Wilhelm Schmitt wrote:
Richard,
When I try this from the sytem monitor, RUN DELETE_ROW "USR_SEL","3*WSZ*10:58 15 NOV 2001",0
I get the message:
FS100: Record "3*WSZ*10:58 15 NOV 2001" does not exist. SSP612: Unable to delete row(s) "3*WSZ*10:58 15 NOV 2001"; 0 row(s) deleted.
Same goes with the function from within a programm.
If I eliminate spaces in the key - through AREV :) - everything works fine.
Any ideas?
Wilhelm
At 15 NOV 2001 12:33PM Wilhelm Schmitt wrote:
I forgot to mention that "3*WSZ*10:58 15 NOV 2001" has double spaces between "..:58" and "15…". It is created with timedate().
Wilhelm
At 15 NOV 2001 02:46PM Richard Hunt wrote:
Ok, I created a record (row) in a file (folder) with the exact id (key) you had. I was able to delete it as before.
Now, here's something…
When I tried to delete it again, I got the same error message as you did. And that is because after I deleted it successfully, it did not exist for the second delete_row.
I believe your ID (key) is not "exactly" what you think it is. Maybe it has trailing blank spaces??? Or some characters that make the visible id (key) look different than the "actual" id (key).
What I would do at this point is this…
1) make a routine to "select" the records (rows) in the file (table).
2) Save the "selectlist" in a file (folder).
3) Edit the record (row) and look for "control characters" or blank spaces.
or try this…
BAD_CHARS='
FOR CHAR=0 TO 31
BAD_CHARS := CHAR(CHAR)NEXT CHAR
FOR CHAR=127 TO 255
BAD_CHARS := CHAR(CHAR)NEXT CHAR
UNDERLINES=STR("_",LEN(BAD_CHARS))
FILE_NAME=(your file name)
IDS='
OPEN FILE_NAME TO FILE_DATA THEN
SELECT FILE_NAMEDONE=0LOOPREADNEXT ID ELSEDONE=1ENDUNTIL DONE DOCONVERT BAD_CHARS TO UNDERLINES IN IDIDS=IDREPEATWRITE IDS TO FILE_NAME, 'JUNK' THENSUCCESS=1ENDEND
Then look at the "JUNK" record (row) and check the "under lines". Maybe that will solve the problem of the record ID (key).
At 15 NOV 2001 05:05PM Wilhelm Schmitt wrote:
Richard,
I tried your suggestion and looked at the JUNK record. There are no strange characters.
I also converted the problem key to ASCII (both in AREV and OI).
"3*WSZ*10:58 15 NOV 2001" renders the correct ASCII values in both cases:
51 42 87 83 90 42 49 48 58 53 56 32 32 49 53 32 78 79 86 32 50 48 48 49
Avoiding the timedate() in the key gives no problem at all. So, that will be the patch for the meantime.
Thanks for your comments.
Wilhelm