Futures_Bright
Registered User.
- Local time
- Today, 18:41
- Joined
- Feb 4, 2013
- Messages
- 69
[Solved]: Sort separated numbers in a text field
Hi all,
In my database, one of the key records is identified by it's "Clause Number" as it appears in the document. Common convention is to number these as in the title example (7.15.1.2) however the number of levels of numbering changes even within a document - only the separator '.' stays the same.
I currently have it set up to A-Z sort on the Clause Number (a text field to allow the format to be maintained, but also the odd occasion where a document uses titles rather than a numbering system). As well as for items such as titles rather than numbers, this approach is limited when the numbers in between the separators hit double digits.
To counteract this I have added a 'manual order' integer field to be used if necessary, and this order supercedes the order of the Clause Number in every section of my database. I'm now setting up a form to allow the user to re-order the items more easily where my initial thinking was 'number the "Manual Order" field in the same order as it is sorted to begin with and then let the user move records up/down as they please.
However it would be more user-friendly if I could create a button to read the format and order based on that (rather than a user click 10+ times to move each and every item falling under 4.2.xx above 4.10.xx-4.19.xx for example). However I'm not too sure how to do this with variable lengths (i.e. potentially unlimited separators).
Does anyone know how to set this up? The way I see it there needs to be two sections to this code:
Any help or alternative solutions are greatly appreciated!
Kind regards,
Michael
Hi all,
In my database, one of the key records is identified by it's "Clause Number" as it appears in the document. Common convention is to number these as in the title example (7.15.1.2) however the number of levels of numbering changes even within a document - only the separator '.' stays the same.
I currently have it set up to A-Z sort on the Clause Number (a text field to allow the format to be maintained, but also the odd occasion where a document uses titles rather than a numbering system). As well as for items such as titles rather than numbers, this approach is limited when the numbers in between the separators hit double digits.
To counteract this I have added a 'manual order' integer field to be used if necessary, and this order supercedes the order of the Clause Number in every section of my database. I'm now setting up a form to allow the user to re-order the items more easily where my initial thinking was 'number the "Manual Order" field in the same order as it is sorted to begin with and then let the user move records up/down as they please.
However it would be more user-friendly if I could create a button to read the format and order based on that (rather than a user click 10+ times to move each and every item falling under 4.2.xx above 4.10.xx-4.19.xx for example). However I'm not too sure how to do this with variable lengths (i.e. potentially unlimited separators).
Does anyone know how to set this up? The way I see it there needs to be two sections to this code:
- Convert the numbers between separators into integer variables (perhaps a prepatory step of counting the number of variables required?)
- Arrange the Clauses in order of left to right, once complete assign a number in the current order.
Any help or alternative solutions are greatly appreciated!
Kind regards,
Michael
Last edited: