Forum Discussion

habhoub's avatar
habhoub
Occasional Contributor
7 years ago
Solved

Hello, i want to ask is it possible to compare a db table store with a table store??

i have a windows application, very complicated. I want to start simply by comparing a list of data displayed in a tab with the real data in the database table. I was thinking what is the best solut...
  • tristaanogre's avatar
    tristaanogre
    7 years ago

    Correct, there is no way of creating a table in the stores via script... that's kinda what I was implying that, to do what you want to do, you'll need to use a different methodology than the Tables checkpoints.  Roughly pseudo-code (not tested, not runnable):

    SQLDataSet = SQLQuery.Open(sqlQueryString);
    OnScreenTableObject = Aliases.myApp.myTable;
    for (var i = 0; i < OnScreenTableObject.RowCount; i++){
        if (SQLDataSet.EOF) break;
        for (var j = 0; j < OnScreenTableObject.ColumnCount; j++){
            Compare(SqlDataSet.Field(j), OnScreenTableObject.Cell(i, j));
        }
        SQLDataSet.NextRow();
    }

     

    So, you loop through you're onscreen table and compare, cell by cell, row by row, and compare the contents.  I kinda shortcutted in the pseudo code to imply that there's a "compare" routine that compares the two.  This is the best way I know of to do the kind of comparison you need to do where the data being compared between SQL and the onscreen data changes from run to run.  There are probably some other minor techniques that can be applied (using DDT driver, storing the SQL data into a table variable and then doing the comparison, etc) but, for what you want to do, a table checkpoint is not going to work for you.