Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Thursday (or Weds) Replace poser
Message
From
19/12/2000 16:00:03
 
 
To
19/12/2000 15:57:01
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00455186
Message ID:
00455188
Views:
32
>Hi One and All
>
>I came across a curious problem yesterday with one of my forms, specifically, saving to a table. The form has a grid displaying a filtered list of records that are in a chronological order (RecordSourceType=1 - Alias, RecordSource=sub_list). I added a class I created that displays time in 12 hour format using a spinner and text box so that the user would see 01:30 PM instead of 13:30. This class does not have a controlsource so I simply update the time displayed whenever I move in the grid - this worked fine. The problem came when I updated the time in this class. In the lost focus event of the class I had this code to update the record
>
>REPLACE sub_list.time1 WITH THIS.value12/100, ;
> sub_list.TIME WITH THIS.VALUE/100, ;
> sub_list.mn WITH LOWER(THIS.meridian)
>
>(Don't ask why I save both time formats - I've forgotten)
>
>This seemed to work until I would click back to the grid when the time changed back to the original. I ran the debugger and browsed the table just after the save and then resumed and it did save properly. I also tried issuing FLUSH just after the replace - still no joy. Eventually I changed the above code to
>
>SELECT sub_list
>REPLACE sub_list.time1 WITH THIS.value12/100, ;
> sub_list.TIME WITH THIS.VALUE/100, ;
> sub_list.mn WITH LOWER(THIS.meridian)
>
>and no it works like a dream!
>
>Anyone know what is going on here or have seen this before.
>
>Thanks
>Charlie

REPLACE works on the currently selected cursor.
It seems as if something is going on where the sub_list cursor wasn't selected before the REPLACE.
If you don't want to do the SELECT first, add the IN clause to REPLACE, e.g.
REPLACE sub_list.time1 WITH THIS.value12/100, ;
	sub_list.TIME WITH THIS.VALUE/100, ;
	sub_list.mn WITH LOWER(THIS.meridian) ;
        <b>IN sub_list</b>
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform