datatype

Post Reply
User avatar
Silvio.Falconi
Posts: 7169
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 3 times

datatype

Post by Silvio.Falconi »

when I go to create the temporary order in memory (see this topic http://forums.fivetechsupport.com/viewtopic.php?f=3&t=41377&start=0&sid=125ed95a697356ee0ca6845b50441ee5)

I load the types of the database columns I am going to save the data type in an array

aTipos [ n ]:= oGrid:aCols[ n ]:cDataType

however, it often happens that a text is displayed in a column but the field in the archive is numeric

but xbrowse it returns me the type of the given character

but if the field is numeric it gives me an error

How can I check if the field in the archive is numeric?


When I create the xbrowse I make an array with all fields aCols

Code: Select all | Expand


local aCols    := { ;
               { "CODICE"  ,  "Codice"             ,,   40, },;
               { "DESC"    ,  "Descrizione"        ,,   150, },;
               { "NUM7"    ,  "Tipo Codice"        ,,   80, },;   //Num7
               { "ALFA1"   ,  "Iva Cee"            ,,   80,AL_CENTER },;    //alfa1
               { "ALFA1"   ,  "Partecipa Platfond" ,,   80,AL_CENTER },;  //alfa1
               { "NUM1"    ,  "% aliquota"         ,"999.99",   80,AL_RIGHT },;
               { "NUM2"    ,  "% Ventilazione"     ,"999.99",   80,AL_RIGHT },;
               { "NUM5"    ,  "% Indetraibile"     ,"999.99",   80,AL_RIGHT },;
               { "ALFA1"   ,  "Iva non esposta"  ,,   80,AL_CENTER }}  //alfa1
 



then on Xbrowse I use

@ 110,10 XBROWSE oBrw SIZE -2,-10 PIXEL OF oTabDlg ;
DATASOURCE oDbf COLUMNS aCols ;
AUTOSORT ;
NOBORDER CELL LINES

WITH OBJECT oBrw:aCols[3]
:bEditValue :={ || TipoIva(oDbf:NUM7,oDbf) }
END

when I make the order it not take the type of field on archive but the current rows ( string)

but if I made
WITH OBJECT oBrw:aCols[3]
:bStrData :={ || TipoIva(oDbf:NUM7,oDbf) }
END

then the order run ok without error because it take the right type of data ( numeric)

But Nages sad me not use :bStrData , so how I can resolve ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
James Bott
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: datatype

Post by James Bott »

METHOD FieldType( n, c ) INLINE If( c == nil, ::aStruct[ n ][ 2 ], ::aStruct[ n ][ 2 ] := c )
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Post Reply