none
Custom Sort of Simple LookupTable. RRS feed

  • Question

  • Using the hierarchical lookup table walkthrough as a starting point - http://msdn.microsoft.com/en-us/library/ms486189.aspx

    I'm trying to perform a custom sort of the data. In the ltValue array, I've added a 5th column to contain the display/sort order. Then in the method that actually creates the treeRow:

    ltTreeRow.LT_VALUE_TEXT = ltValue;
    ltTreeRow.LT_VALUE_DESC = ltDescription;
    ltTreeRow.LT_VALUE_SORT_INDEX = decinmal.parse( ltSortOrder);

    The debugger show the ltSortOrder value to be as expected..

    I'm gettig a "LookupTableSortOrderMustComeAfterParentSortOrder" -- that would be understandable if there were actually a hierarchy; but this is a single level data structure..

     

     

    // 2.Create a sample data structure in code that includes the value, description, and level of each item in the hierarchy. The following example includes a fourth field that specifies which item should be the default value.

     

     

    string[,] ltValues =
    {
    {
    "On Target", "Within resource budget", "0", "0","0.0"},
    {
    "Anticipate Overrun", "Anticipate resrouce overrun", "0", "0","100.0"},
    {
    "Over Budget", "Over budget funds or staff","0","0","200.00"}
    };

     

    The goal is to have the values display in order of the 0.00, 100.00, 200.00 ( decimal sort order value in the 5th column).

    This seems like it would be used on quite a few lookup columns, where there is an implied ordering of the values that is not "alphabetical"... 

     

     

     


    All science is either physics or stamp collecting
    decimal.Parse(ltSortOrder);
    • Edited by GUYO Tuesday, July 27, 2010 12:49 AM still getting screwed up
    Tuesday, July 27, 2010 12:47 AM