Dates and tab-delimited files

For the life of me, I can't figure out this one aspect. Anybody willing to give help will be appreciated. My date value from my tab-delimited file is the number of milliseconds since 1/1/70 UTC as returned by getTime(). I am using a tab-delimited file. I'm using the following code. No matter what I try, the text format is always the data format!!!

//      create data formats
        var string = new Active.Formats.String;
        var number = new Active.Formats.Number;
        var date = new Active.Formats.Date;

        //      define formatting rule for text output

        date.setTextFormat("dd mmm yy");

        var table = new Active.Text.Table;
        table.setProperty("URL", "/dev-bin/getGridText.pl?gridtype=1");

        //      set column formatting
        formats = [number, string, string, string, string, date, date];

        var obj = new Active.Controls.Grid;
        obj.setDataText(function(i, j){return formats[j].dataToText(myData[i][j]
        obj.setDataValue(function(i, j){return formats[j].dataToValue(myData[i][

        obj.setProperty("column/count", 5);
        obj.setModel("data", table);

September 23,
The date formatting object does not have proper method for handling dates in this format (milliseconds) but it is easy to fix because this is exactly the internal date value

var date = new Active.Formats.Date;
    date.setTextFormat("dd mmm yy");
    date.dataToValue = function(v){return v}

Also Text/CSV model does not handle formatting at all, so we have to fix it:

var table = new Active.Text.Table;
    var formats = [string, string, date, string, string];
    var _getText = table.getText;
    table.getText = function(i, j){
        return formats[j].dataToText(_getText.call(this, i, j));

That should be enough to make it work...
Alex (ActiveWidgets)
September 26,

This topic is archived.

See also:

Back to support forum