Question about table control

Discussion in 'Questions (Windows Mobile)' started by EzCoder, Oct 26, 2007.

  1. EzCoder

    EzCoder Member Licensed User

    First of all, let me say **Thank You!** for such a fantastic product!
    The more I use it, the better I like it. :)
    :sign0098:

    On with the question...
    I've been doing some testing of the table control, converting data from one delimited format to another (piped to tabbed, comma to piped, etc...) and ran across an oddity that I need some help with. As the example I've attached shows, I can easily sort the table on a given column and it works flawlessly. However, once the table is sorted, saving the results (Table1.SaveCSV) does not save the data as sorted in the table.

    Here's my code with some sample data tagged onto the end:
    Code:
    Sub Globals
       
    'Declare the global variables here.

    End Sub

    Sub App_Start
       Form1.Show
       Table1.Height = 
    200
       Table1.Width = 
    240
       Table1.Visible = 
    true
       Table1.Enabled = 
    true
       Table1.Color = 
    255,255,255
       Table1.HeaderColor = 
    100,200,222
       Table1.LinesColor = cGold
       Table1.LoadCSV (
    "data1.csv""|"TrueTrue)

       AddButton (Form1, 
    "Button1"2022010030"Click Me!")
       Button1.color= Form1.Color
       AddEvent (
    "Button1", Click, "ButtonsClick")
       
       
    End Sub

    Sub ButtonsClick
    'I = Asc ("9")
    Table1.TableSort ("PartNumber ASC")
    Table1.SaveCSV (
    "exporteddata.csv"Chr(9),False)'tabbed format
    End Sub

    'Sample Data Used For Testing:
    '
    'Whse|PartNumber|OnHand|
    '2|100602-0025|1|
    '2|10A902-1618|1|
    '4|10A982-1650|18|
    '2|10A982-1650|2|
    '2|118432-0035|1|
    '4|118432-0035|3|
    '4|118432-0036|1|
    '2|118432-0060|1|
    '4|118432-0140|28|
    '4|121312-0060|11|
    '1|121312-0060|36|
    '4|124335-8104|6|
    '2|124335-8101|1|
    '2|124335-8104|9|
    '2|125K02-0005|3|
    '2|125K02-0015|2|
    '2|125K07-0060|1|
    '4|125K07-0060|1|
    '2|126302-0279|1|
    '4|126312-0023|12|
    '2|126312-0023|1|
    '2|126312-0023|1|
    It seems that once the table has been sorted, it would save the same way...
    Am I just missing something again?

    Ez
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Sorting the table doesn't change the database.
    It only changes the way it appears.
    Filtering the table will also won't change the database.
    If you want to save the result you can copy the rows to a new table and then save the new table data.
     
  3. EzCoder

    EzCoder Member Licensed User

    Okay, thank you very much for the info!
     
Loading...