General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Hi John,
Most likely, those records were implicitly or explicitly "TABLEUPDATEd" by the time you are trying to revert them. Check GETFLDSTATE(-1) for those records to see if they still have uncommitted changes.
Thanks,
Aleksey.
>I had a huge table which I split into 7 smaller tables and set a relation in the first table (LABORATORY). For every record in LABORATORY there is and only is one relational record in each of the oher 6 tables.
>
>ADD-
>I have two command buttons on a form, Add and Undo. When user clicks add I append a blank record to each table and replace some fields with some ID information.
>UNDO-
>When user clicks undo I issue a TABLEREVERT() and abandon the add operation and expect to revert all tables.
>
>PROBLEM---
>My first TABLEREVERT() works while the other 6 TABLEREVERT do not revert the tables.
>
>Is there something I am doing wrong?
>
>Below is my code:
>=================
>
>In the load event of the form:
>*-------------------------------------------Load()
>USE LABORATORY IN 0 ORDER TAG ID OF LABORAROTY SHARED
>CURSORSETPROP("Buffering", 2, "LABORATORY")
>USE LAB_PHYSICAL IN 0 ORDER TAG CLAB_ID OF LAB_PHYSICAL SHARED
>CURSORSETPROP("Buffering", 2, "LAB_PHYSICAL")
>USE LAB_VISUAL IN 0 ORDER TAG CLAB_ID OF LAB_VISUAL SHARED
>CURSORSETPROP("Buffering", 2, "LAB_VISUAL")
>USE LAB_MECHANICAL IN 0 ORDER TAG CLAB_ID OF LAB_MECHANICAL SHARED
>CURSORSETPROP("Buffering", 2, "LAB_MECHANICAL")
>USE LAB_COMP IN 0 ORDER TAG CLAB_ID OF LAB_COMP SHARED
>CURSORSETPROP("Buffering", 2, "LAB_COMP")
>USE LAB_TREATMENT IN 0 ORDER TAG CLAB_ID OF LAB_TREATMENT SHARED
>CURSORSETPROP("Buffering", 2, "LAB_TREATMENT")
>USE LAB_RUNNING IN 0 ORDER TAG CLAB_ID OF LAB_RUNNING SHARED
>CURSORSETPROP("Buffering", 2, "LAB_RUNNING")
>
>SET RELATION TO ;
> ID INTO LAB_PHYSICAL,;
> ID INTO LAB_VISUAL, ;
> ID INTO LAB_MECHANICAL, ;
> ID INTO LAB_COMP, ;
> ID INTO LAB_TREATMENT, ;
> ID INTO LAB_RUNNING, ;
> CWORKORDERID INTO SALEORDER_ITEMS ;
> IN LABORATORY
>
>*-------------------ADD NEW RECORD (COMMAND BUTTON ON THE FORM)-------------
>LOCAL ARRAY laLAB_TABLES(6)
>LOCAL li
>WITH THISFORM
> .oCurrentData.RecordAppend()
> laLAB_TABLES[1] = "LAB_PHYSICAL"
> laLAB_TABLES[2] = "LAB_VISUAL"
> laLAB_TABLES[3] = "LAB_MECHANICAL"
> laLAB_TABLES[4] = "LAB_COMP"
> laLAB_TABLES[5] = "LAB_TREATMENT"
> laLAB_TABLES[6] = "LAB_RUNNING"
> FOR li = 1 TO ALEN("laLAB_TABLES")
> APPEND BLANK IN laLAB_TABLES[li]
> REPLACE KEY WITH SYS(2015) IN laLAB_TABLES[li]
> REPLACE tAddStamp WITH DATETIME() IN laLAB_TABLES[li]
> REPLACE cAddBy WITH pcUserName IN laLAB_TABLES[li]
> NEXT li
>ENDWITH
>
>*--------ABANDON - UNDO ADDITION OF NEW RECORD (COMMAND BUTTON ON THE FORM)-
>WITH THISFORM.oCurrentData
> llReturnValue = TABLEREVERT(.F., ._cAlias)
>IF NOT llReturnValue = 0
> TABLEREVERT(.F., "LAB_PHYSICAL")
> TABLEREVERT(.F., "LAB_VISUAL")
> TABLEREVERT(.F., "LAB_MECHANICAL")
> TABLEREVERT(.F., "LAB_COMP")
> TABLEREVERT(.F., "LAB_TREATMENT")
> TABLEREVERT(.F., "LAB_RUNNING")
>ENDIF
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only