Guys,
I am looking for some advice regarding the following problem. I think I might be over complicating it.
I have an array where each element is a delimited string. Each delimited string holds data associated with a Content Control in the ActiveDocument, e.g.
arrCCData(1) = 2|21|CC2 in textbox 1|16
arrCCData(2) = 1|56|Current Project Cost in Pounds|30
arrCCData(3) = 1|113|Completion Date|15
arrCCData(4) = 1|32|Contractor|10
arrCCData(5) = 1|371|Video|5
arrCCData(6) = 2|1|CC1 in textbox 1|16
arrCCData(7) = 0|1|ClientSurveyNumber|18
arrCCData(8) = 1|399|way|3
arrCCData(9) = 1|527|You can also|12
arrCCData(10) = 1|5|Client|6
arrCCData(11) = 0|1|Footer CC|9
arrCCData(12) = 0|22|SurveyDate|10
I am trying to sort the array by token 1 of each element to achieve:
0|1|ClientSurveyNumber|18
0|1|Footer CC|9
0|22|SurveyDate|10
1|5|Client|6
1|32|Contractor|10
1|56|Current Project Cost in Pounds|30
1|113|Completion Date|15
1|371|Video|5
1|399|way|3
1|527|You can also|12
2|1|CC1 in textbox 1|16
2|21|CC2 in textbox 1|16
Then finally by token 2 to achieve the final result:
0|1|ClientSurveyNumber|18
0|1|Footer CC|9
0|22|SurveyDate|10
1|5|Client|6
1|32|Contractor|10
1|56|Current Project Cost in Pounds|30
1|113|Completion Date|15
1|371|Video|5
1|399|way|3
1|527|You can also|12
2|1|CC1 in textbox 1|16
2|21|CC2 in textbox 1|16
What is the easiest way to do this?
I am currently using a customized quicksort procedure to sort the array by token 2 of each element. I am then looping through the partially sorted array and copying the elements into a separate array. The position in the new array is based on token 1.
It's easier to explain by example. Any advice on the best way to do this would be appreciated. See attached.
Joe