Stephane,
I've dealt with the question of saving list info by creating a data
table to hold list information. Then, prior to an update a set of
methods is run to copy the list info into the data table. After the
update another set of methods is run to copy the data back from the
table into the lists.
The drawbacks are that you have to be able to trigger the methods and
you must explicitly list all of the lists you want to save in code.
I use 'Prepare for update' and 'Finish update' menu items to
trigger the code. My update instructions to the users tell them to
use these buttons as part of the update process.
Here's my code if you find it useful.
Allen
Table: Lists `this table holds the list name, list elements and
element position within the list
Id: alpha 32 `this is the name of the list
Item: alpha 80 `this is a list element
Sequence: Longint `this is the item position in the list
*************
Method used to save an individual list:
Method: Lists_Save_One
`saves the contents of a list into an array of records
`ham 7/99
C_STRING(32;$sList_Name)
$sList_Name:=$1
`remove old list contents from storage table
MESSAGES OFF
QUERY([Lists];[Lists]Id=$sList_Name)
DELETE SELECTION([Lists])
LIST TO ARRAY($sList_Name;$asList_Contents) `save the current list
contents as an array
For ($i;1;Size of array($asList_Contents))
CREATE RECORD([Lists])
[Lists]Id:=$sList_Name
[Lists]Item:=$asList_Contents{$i}
[Lists]Sequence:=$i `keep track of the entry order
SAVE RECORD([Lists])
End for
MESSAGES ON
*******************
Method: List_Load_One
`saves the contents of an array of records into a list
`ham 7/99
C_STRING(32;$sList_Name)
$sList_Name:=$1
`get list contents from storage table
MESSAGES OFF
QUERY([Lists];[Lists]Id=$sList_Name)
`only replace list contents if there is something
`to replace them with
If (Records in selection([Lists])>0)
ORDER BY([Lists];[Lists]Sequence;>)
SELECTION TO ARRAY([Lists]Item;$asList_Contents)
ARRAY TO LIST($asList_Contents;$sList_Name)
Else
`this list has never been set - clear whatever might be in
the current list.
`this will clear the dev gus lists for departments which
have never initialized this list.
ARRAY TEXT($atList_Contents;0)
ARRAY TO LIST($atList_Contents;$sList_Name)
End if
MESSAGES ON
***********
Method fragment to save my lists (part of 'Prepare for update')
LIST_Save_One ("Actions")
LIST_Save_One ("Agencies")
LIST_Save_One ("Agency_Division")
LIST_Save_One ("Agency_HList")
Method fragment to load the lists (part of 'Finish update')
LIST_Load_One ("Agencies")
LIST_Load_One ("Agency_Division")
LIST_Load_One ("Agency_HList")
LIST_Load_One ("Agency_List")
>Good day,
>
>I have created a database for a local group a few years ago. Since
>then, the users have added items to lists, added and modified users
>and passwords, etc.
>
>Now I want to provide them with an update I have done to the DB.
>However if I only send them a new structure file, they will loose
>all the users information, and all the list items. How can I update
>the DB without loosing all that?
>
>Can 4D create a patch to update only specific code? Or is there a
>3rd party solution?
>
>Thank you,
>
>Stephane Potvin
>
>**********************************************************************
>4D Basics hosted by 4D, Inc.
http://www.4D.com/>
>4D v11 SQL - A 21st Century database for 21st Century developers
>
http://www.4D.com/products/new.html>
>To Unsubscribe: mailto:
4DBasics-off@...
>**********************************************************************
--
------------------------------
Allen Matlick
allen@...
805-893-5219
------------------------------
**********************************************************************
4D Basics hosted by 4D, Inc.
http://www.4D.com/4D v11 SQL - A 21st Century database for 21st Century developers
http://www.4D.com/products/new.htmlTo Unsubscribe: mailto:
4DBasics-off@...
**********************************************************************