Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Funadamental Design Flaws - You Wannem I Gottem
Message
From
15/06/1998 11:44:54
 
 
To
12/06/1998 23:03:14
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00106772
Message ID:
00108245
Views:
40
Could you give me some idea what a packlist looks like?

Lincoln,

The pack list is just a table or array containing the names of the tables in which one or more records have been deleted. If you are using an application-wide packlist, it probably should be a table. If form-wide, an array which is a property of the form is ok.

The table us updated whenever a record is deleted. I use a function for that purpose...
*:******************************************************************************
*:
*: Procedure TABLEDELETE
*:
*:******************************************************************************
FUNCTION TABLEDELETE(lnRecord,lcAlias)
*-- If the alias was not passed, assume the current work area
IF empty(lcAlias)
    lcAlias = alias()
ENDIF
*-- If no alias passed and no file open in current work area, return .F.
IF empty(lcAlias)
    RETURN .f.
ENDIF
*-- If no record is specified in lnRecord, assume the current record
IF EMPTY(lnRecord)
    lnRecord = RECNO(lcAlias)
ENDIF
*-- Delete the record specified in lnRecord
DELETE FOR RECNO() = lnRecord IN (lcAlias)
*-- If the recore was successfully deleted, update the packlist
IF DELETED(lcAlias)
    UPDATEPACKLIST(lcAlias,1)
    RETURN .t.
ENDIF
RETURN .f.

*:******************************************************************************
*:
*: Procedure UPDATEPACKLIST
*:
*:******************************************************************************

LPARAMETERS lcAlias, lnAction
*-- lnAction codes are 1 = Add, 2 = Delete
LOCAL i ;  && loop counter
      lnReccount
*-- Store the packlist reccount() to a local var to avoid repeated calls
*   to the reccount() function.
lnReccount = RECCOUNT("packlist")
IF lnReccount > 0
    *-- See if lcAlias is already in the packlist
    FOR i = 1 TO lnReccount
        IF LOWER(fcTableName) = LOWER(lcAlias)
           EXIT
        ENDIF
    NEXT
    IF i <= lnRecCount
        *-- table is already in the list, and action requested is
        *   delete.  Since the table name is already in the list, if the
        *   action requested is add, no additional action is necessary.
        IF lnAction # 1
           TABLEDELETE("packlist",i)
        ENDIF
    ENDIF 
ELSE
    IF lnAction = 1 && Add record
       INSERT INTO packlist (lcTableName) VALUES (lcAlias)
    ENDIF
ENDIF

RETURN
Since I just banged this code out from memory, I must disclaim an responsibility for syntax and other errors -- but it should look something like this.

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform