void CIBViewApp::CGDCountxy(void)
{
// Count for for fields
// data saved as <x1><y1>,<x1><y2>,<x1><y3>,<x2><y1>,<x2><y2> etc or
    int *ipuse, *xp, cox,coy,xlen, strskip;
    int xdateoffset, ydateoffset;    // Data and date types
    int idxx, idxy;                        // Index into the results buffer
    char *cp, *cp2, offsetv;
    void *xptr, *yptr;
    // Read this views list
    cp = DataChainStart[theCurrentView->BufferNumber];
    // Next row pointer
    offsetv = (theCurrentView->BufferNumber + 1) * SO_charp;
    // Offset to the index not the value
    cox = CalcingColOffset[0];coy = CalcingColOffset[1];
    // set the pointers for the x data types
    switch (DataColType[theCurrentView->GraphCol[0].DataColNum])
    {
        case COL_TYPE_STRING: _asm{ lea eax, dtstringx
                  mov xptr,eax} break;
        case COL_TYPE_INT:
            _asm{    lea eax, dtintx
                    mov xptr,eax} break;
        case COL_TYPE_CURRENCY:
            _asm{ lea eax, dtcurrencyx
                mov xptr,eax} break;
        case COL_TYPE_FLOAT:
            _asm{ lea eax, dtfloatx
                  mov xptr,eax} break;
        case COL_TYPE_DATE_AUTO:
            // Calc the offset for the date
            switch(theCurrentView->GraphCol[0].DateType)
            {
                case GRAPH_DATE_OP_DOW :           
                    _asm{ lea eax, dtdate1x
                            mov xptr,eax} xdateoffset = SO_double+SO_int;break;
                case GRAPH_DATE_OP_DOM :
                    _asm{ lea eax, dtdate1x
                            mov xptr,eax} xdateoffset  = SO_double+SO_int+SO_char;break;
                case GRAPH_DATE_OP_WEEK :
                    _asm{ lea eax, dtdate1x
                            mov xptr,eax}xdateoffset = SO_double+SO_int+(SO_char*2);break;
                case GRAPH_DATE_OP_MONTH :
                    _asm{ lea eax, dtdate1x
                        mov xptr,eax} xdateoffset = SO_double+SO_int+(SO_char*3);break;
                case GRAPH_DATE_OP_YEAR :
                    _asm{ lea eax, dtdateyearx
                            mov xptr,eax}xdateoffset = SO_double+SO_int + (SO_char * 4);break;
                case GRAPH_DATE_OP_DATE :
                    _asm{    lea eax, dtdateabsx
                            mov xptr,eax} break;
            }
    }
    // set the pointers for the y data types
    switch (DataColType[theCurrentView->GraphCol[1].DataColNum])
    {
        case COL_TYPE_STRING: _asm{ lea eax, dtstringy
                  mov yptr,eax} break;
        case COL_TYPE_INT:
            _asm{    lea eax, dtinty
                    mov yptr,eax} break;
        case COL_TYPE_CURRENCY:
            _asm{ lea eax, dtcurrencyy
                mov yptr,eax} break;
        case COL_TYPE_FLOAT:
            _asm{ lea eax, dtfloaty
                  mov yptr,eax} break;
        case COL_TYPE_DATE_AUTO:
            // Calc the offset for the date
            switch(theCurrentView->GraphCol[1].DateType)
            {
                case GRAPH_DATE_OP_DOW :           
                    _asm{ lea eax, dtdate1y
                            mov yptr,eax} ydateoffset = SO_double+SO_int;break;
                case GRAPH_DATE_OP_DOM :
                    _asm{ lea eax, dtdate1y
                            mov yptr,eax} ydateoffset  = SO_double+SO_int+SO_char;break;
                case GRAPH_DATE_OP_WEEK :
                    _asm{ lea eax, dtdate1y
                        mov yptr,eax} ydateoffset = SO_double+SO_int+(SO_char*2);break;
                case GRAPH_DATE_OP_MONTH :
                    _asm{ lea eax, dtdate1y
                        mov yptr,eax} ydateoffset = SO_double+SO_int+(SO_char*3);break;
                case GRAPH_DATE_OP_YEAR :
                    _asm{ lea eax, dtdateyeary
                        mov yptr,eax} ydateoffset = SO_double+SO_int + (SO_char * 4);break;
                case GRAPH_DATE_OP_DATE :
                    _asm{    lea eax, dtdateabsy
                        mov yptr,eax} break;
            }
            break;
            default:ASSERT(0); break;
    }
    // The length of each x line in the buffer (is the number of Y entries
    xlen = theCurrentView->RangeCount[theCurrentView->GraphCol[1].DataColNum];
    while(cp)
    {  
        // Get the X index
        _asm{    call xptr}
        // Get the Y index
        _asm {    call yptr}
        // Update the counter
        ipuse = CalcingIxTotsBuff + (idxx * xlen) + idxy;    // Find the point in the buffer
        *ipuse = *ipuse + 1;                            // Add the value into the total
        // Next row
        cp = * ((char **) (cp+offsetv));  
    }
    return;
// X functions
dtstringx:
    strskip =  *((short *) (cp + cox));    // Find the number of chars to skip
    xp = (int *) ((cp + strskip));        // Find the entry and save index pointer
    idxx = *xp;                            // Read the index value (not the data value)
    _asm{ ret}
dtintx:
dtcurrencyx:
dtfloatx:
    xp = (int *) (cp + cox);        // Find the column pointer
    idxx = *xp;                        // Read the index value (not the data value)
    _asm{ ret}
dtdate1x:
    cp2 = cp + cox;                        // Find the date entry pointer
    idxx = (*(cp2+xdateoffset)) - 1;    // Goto the desired part of the date entry
    _asm{ ret}
dtdateyearx:
    cp2 = (cp + cox);                // Find the date entry pointer
    idxx = *((int *) (cp2+xdateoffset));    // Goto the year index
    _asm{ ret}
dtdateabsx:
    xp = (int *) (cp + cox);        // Find the column pointer
    idxx = *xp;                        // Read the index value (not the data value)
    _asm{ ret}
// Y Functions
dtstringy:
    strskip =  *((short *) (cp + coy));    // Find the number of chars to skip
    xp = (int *) ((cp + strskip));        // Find the entry and save index pointer
    idxy = *xp;                            // Read the index value (not the data value)
    _asm{ ret}
dtinty:
dtcurrencyy:
dtfloaty:
    xp = (int *) (cp + coy);        // Find the column pointer
    idxy = *xp;                        // Read the index value (not the data value)
    _asm{ ret}
dtdate1y:
    cp2 = cp + coy;                        // Find the date entry pointer
    idxy = (*(cp2+ydateoffset)) - 1;    // Goto the desired part of the date entry
    _asm{ ret}
dtdateyeary:
    cp2 = (cp + coy);                // Find the date entry pointer
    idxy = *((int *) (cp2+ydateoffset));    // Goto the year index
    _asm{ ret}
dtdateabsy:
    xp = (int *) (cp + coy);        // Find the column pointer
    idxy = *xp;                        // Read the index value (not the data value)
    _asm{ ret}
  
}