Table.Filter

Discussion in 'Questions (Windows Mobile)' started by Phil Budge, May 13, 2007.

  1. Phil Budge

    Phil Budge New Member Licensed User

    With the Table.Filter command is it possible to use variables as the Column and Arguement as I can only make this function work with fixed values.
     
  2. specci48

    specci48 Well-Known Member Licensed User

    Hi Phil,

    let's take the following Table

    Table1.AddCol(cNumber, "Number", 50)
    Table1.AddCol(cString, "Value1", 50)
    Table1.AddCol(cString, "Value2", 50)

    Table1.AddRow(1, "A1", "red")
    Table1.AddRow(1, "A2", "green")
    Table1.AddRow(2, "A2", "blue")
    Table1.AddRow(2, "A2", "white")
    Table1.AddRow(2, "A4", "black")

    and these two variables

    arg1 = 2
    arg2 = "A2"

    For a column with cNumber format we could code this filter

    Table1.Filter("Number = " & arg1)

    Result: the rows with "blue", "black" and "white".

    To code a filter with a column of cString format you have to add some ' around the variables like

    Table1.Filter("Value1 = '" & arg2 & "'")

    Result: the rows with "green", "blue" and white.


    specci48
     
  3. Phil Budge

    Phil Budge New Member Licensed User

    Thanks specci48 that explained the syntax ( I've only been using BASIC4PPC a couple of days)
     
Loading...