PDA

View Full Version : Appending data to the end of a data field


ABC123

LAURIE MASCARI
10-12-2000, 12:02 PM
I have attached the following script to a button to append some text to the bottom of a memo field. The problem is it completely replaces the information in the Memo field. I would like to retain the information already in the memo field and put the new text behind it. The text is often more than 255 characters so I can't turn it into a variable. Is there another way to accomplish this?
Thanx,
Laurie

dbh = db_current()
IF db_mode_get(dbh) > 0 THEN
ui_msg_box("Warning","Already in data entry mode.", 48)
ELSE
commit_flag = .T.
change_begin(dbh)
ON ERROR GOTO error_handler
REPORTIN->WORK_PERF = "ANTENNA SYSTEM AIRCRAFT SHOULD BE CHECKED FOR COMPLIANCE OF F.A.R. 91.413 AND 43 APP-F - MEETS MINIMUM PERFORMANCE STANDARDS OF C74c"
change_end(dbh, commit_flag)
END IF
card_resynch()
END
error_handler:
commit_flag = .F.
RESUME NEXT

Lowell Wardlow
10-12-2000, 03:46 PM
Laurie- assuming that the memo field is REPORTIN->work_perf,
then you are overwriting it before saving.

You show :

Change_begin(dbh)
REPORTIN->work_perf = " some data"
change_end(dbh)

which completely replaces the old memo with the new data.

try :

change_begin(dbh)
REPORTIN->work_perf = REPORTIN->work_perf + " new data"
change_end(dbh)

Further, since the new data is hard coded into the script,
it appears you are always intending to add just this information. You might try, instead, having a 2nd memo field
in the table and add just this memo to it. If this is all that will ever be added, you might also think about just having it be another character field.

Lowell

Melvin Davidson
10-13-2000, 05:44 AM
Laurie,

I had a similar problem a few years ago. I resolved it by by temporarily writing the 'original' memo to a disk file and then appending. If Lowell's answer does not suffice, then please notify me and I will send you the full script (complicated) to do what you need.

Regards,
Melvin

LAURIE MASCARI
10-13-2000, 06:24 AM
Appending data to a Memo Field

LAURIE MASCARI
10-13-2000, 06:51 AM
Hi Melvin,
You are correct. Lowell's idea doesn't work in this instance because
the data in the field exceeds the 255 character limit for a variable.

Please send me a copy of your script. I think it will solve my
problem.

Thanx,
Laurie

Melvin Davidson
10-13-2000, 09:45 AM
Laurie,

I'll try to attach script here so that others can also use.

Just in case it doesn't work, I'm also emailing direct to you.

Enjoy.
Melvin

Lowell Wardlow
10-13-2000, 12:44 PM
Melvin - you are obviously correct - my answer wont work,
since the variable is actually a pointer to the start of
the memo, not the memo itself.

I blame it on (temporary, I hope) senile dementia.

Lowell