Numeric sort of alphanumeric values

Hi All

Is it possible to sort a document collection (using Lotus script) depending on an alphanumeric field? What I am trying to achieve is that if the values of the alphanumeric field in a document collection is:

1.2

10

1.2a

12

1.2.3

11

1.3

2

After sorting the values are

1.2

1.2a

1.2.3

1.3

2

10

11

12

TIA

Alpna

Subject: Numeric sort of alphanumeric values

I think you’ll need to pad the left side of the strings with zero’s, sort them, and then remove the zeros.

Original

Padded

Sorted

Unpadded

1.2

10

1.2a

12

1.2.3

11

1.3

2

0001.2

0010

0001.2a

0012

0001.2.3

0011

0001.3

0002

0001.2

0001.2a

0001.2.3

0001.3

0002

0010

0011

0012

1.2

1.2a

1.2.3

1.3

2

10

11

12

Subject: RE: Numeric sort of alphanumeric values

To be more specific, you could have a hidden sorted view column with a formula like this:

@Implode(@Right(“000” + @Explode(docnumber; “.”); 4); “.”)

which would change 1.12.3a into 0001.0012.003a

Of course, there’s some difficulty in that 3a would follow 12, and I suspect you wanted it to precede 12. You might have to use @Transform and test how many digit characters there are. This is not the sort of thing you want to do in a view column, however, if best performance is wanted; you would want a hidden computed field on the form.

Subject: RE: Numeric sort of alphanumeric values

Thanks for your reply. But, I want to sort a collection of documents using Lotus Script. Any ideas?

Thinking aloud, perhaps I should create a view with the correct sort and then use ViewEntry class? Will that work?

Regards

Alpna

Subject: Yes that would work. You can also walk it by view.GetFirstDocument, GetNextDocument(doc) etc.