P
Patrick Maslanka
I'm attempting to find a way to properly sort a field that contains an OID
string.
For those of you that dont know what an OID string is, it is a value that
describes index choices used to move down a series of nested indicies ....
The choice is a non negative INTEGER value ( ie 0, 1, 2, ... Infinity )
The format of the string is #.#.#.... IE the choice value is seporated by
periods.
The depth of the string ( how many numbers it contains ) is dynamic. IE it
could be 4 numbers or 40 numbers in the series.
Currently, using a field type of General will result in an OID string being
interpreted as a text string, and sorting is alpha numberic by character
position.
This is fine, unless the indicies can have choice values greater than 9.
In the case where such an index does exist, the text based alpha sort fails
to sort the strings correctly, because it will group the multi digit choices
with the character matched single digit choices ...
Example
1.2.6.1
1.2.6.10 <- this is out of order
1.2.6.3
1.2.6.7
The correct order should be:
1.2.6.1
1.2.6.3
1.2.6.7
1.2.6.10
-------------------
I am looking for a solution that would basically allow me to take this
general field type ( by redefinition or some other means ) and treat it as
multiple numbers. Level would be sorted as a standard number format.
Something like the following ...
1 2 3 4
| | | |
v v v v
1 . 3 . 6 . 1
1 . 3 . 6 . 3
1 . 3 . 6 . 7
1 . 3 . 6 . 10
In order to sort properly, if the depth was not equal between the strings,
it would have to assume .0.0.....0 at the end of the string to the matching
depth
Ive looked at custom number formats, but none of the definition starting
points seems to meet my needs.
I have considered dumping the string to a text file, and having a linked
table pick it back up, using the . as a delimiter, and describe the fields as
numberic. This would function for what I am attempting, if its possible to
sort based on more then 1 column of the database.
My only other option would be to programically convert the OID string into a
numeric value, or to place leading 0 characters into the string, forcing it
to be a specified width. Since i am not a macro programmer, im now sure how
to do this, but the algorithm would be
1) set new oid string =""
2) read characters and put into a temp string until character = "." or " "
3) count the number of characters in the temp string
4) insert "0" at end of new oid string 4 - count times
5) insert temp string at end of new oid string
This would have to be looped a number of times based on how deep into the
tree you wanted to insert leading 0's into the OID string, to force it to
sort properly.
--------------------------------
Any suggestion or insight into how to accomplish what im attempting would be
greatly appreciated ... I wish i knew of a way to define a custom field type
other then numeric, so i could actually define it and the sort properties of
the type, and then use it in all office applications.
Thnx in advance, for your assistance.
string.
For those of you that dont know what an OID string is, it is a value that
describes index choices used to move down a series of nested indicies ....
The choice is a non negative INTEGER value ( ie 0, 1, 2, ... Infinity )
The format of the string is #.#.#.... IE the choice value is seporated by
periods.
The depth of the string ( how many numbers it contains ) is dynamic. IE it
could be 4 numbers or 40 numbers in the series.
Currently, using a field type of General will result in an OID string being
interpreted as a text string, and sorting is alpha numberic by character
position.
This is fine, unless the indicies can have choice values greater than 9.
In the case where such an index does exist, the text based alpha sort fails
to sort the strings correctly, because it will group the multi digit choices
with the character matched single digit choices ...
Example
1.2.6.1
1.2.6.10 <- this is out of order
1.2.6.3
1.2.6.7
The correct order should be:
1.2.6.1
1.2.6.3
1.2.6.7
1.2.6.10
-------------------
I am looking for a solution that would basically allow me to take this
general field type ( by redefinition or some other means ) and treat it as
multiple numbers. Level would be sorted as a standard number format.
Something like the following ...
1 2 3 4
| | | |
v v v v
1 . 3 . 6 . 1
1 . 3 . 6 . 3
1 . 3 . 6 . 7
1 . 3 . 6 . 10
In order to sort properly, if the depth was not equal between the strings,
it would have to assume .0.0.....0 at the end of the string to the matching
depth
Ive looked at custom number formats, but none of the definition starting
points seems to meet my needs.
I have considered dumping the string to a text file, and having a linked
table pick it back up, using the . as a delimiter, and describe the fields as
numberic. This would function for what I am attempting, if its possible to
sort based on more then 1 column of the database.
My only other option would be to programically convert the OID string into a
numeric value, or to place leading 0 characters into the string, forcing it
to be a specified width. Since i am not a macro programmer, im now sure how
to do this, but the algorithm would be
1) set new oid string =""
2) read characters and put into a temp string until character = "." or " "
3) count the number of characters in the temp string
4) insert "0" at end of new oid string 4 - count times
5) insert temp string at end of new oid string
This would have to be looped a number of times based on how deep into the
tree you wanted to insert leading 0's into the OID string, to force it to
sort properly.
--------------------------------
Any suggestion or insight into how to accomplish what im attempting would be
greatly appreciated ... I wish i knew of a way to define a custom field type
other then numeric, so i could actually define it and the sort properties of
the type, and then use it in all office applications.
Thnx in advance, for your assistance.