I'm looking to create a dbase driven policies and procedures system to display on my company's intranet.
I've set up a table to contain the policy category names (Employee discounts, Smoking policy etc) and their numbers. I need a way to be able to delete and add categoies and have the dbase update the number of each category so they are displayed in order. Kind of an renumbering autonumber if you get my drift...
But thats not all...Within each category there will be several clauses (1.1, 1.2, 1.3 etc - with the number before the dot corresponding to the category number). The number of the clause also has to be auto-renumbering so I can add/delete clauses in the middle and have the rest renumber.
Any help you could give me would be gladly appeciated...
three sorting fields: intClause; intSubclause; intSpecial.
starting from a correctly ordered intClause.intSubclause table (ultimately this could be an empty table) you feed the records into a recordset ordered by intClause and intSubclause. now run through the ordered recordset allocating intSpecial with gaps (like old BASIC line-numbering 10, 20, 30, 40 etc)
when you insert a clause:
intSpecial = current intSpecial-5
when you insert a subclause:
intClause= current intClause
intSubclause = -99
intSpecial = current intSpecial -5
when you delete - just delete (after suitable handling for deleting a clause that may have non-deleted subclauses)
after each insert, close the recordset and open a new one but this time ordered by intSpecial: now run through the ordered recordset...
integers setC, setS, getC
while recordset not eof
setC = setC+1
while !intClause = getC
!intClause = setC
!intSubclause = setS
end while !intClause = getC
end while recordset not eof
now go back to... starting from a correctly ordered intClause.intSubclause table and do the next insert.
i haven't tried this in code, but it ought to work.