Page 1 of 1

datatype

Posted: Mon Feb 07, 2022 11:57 am
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 ?

Re: datatype

Posted: Tue Feb 15, 2022 3:53 pm
by James Bott
METHOD FieldType( n, c ) INLINE If( c == nil, ::aStruct[ n ][ 2 ], ::aStruct[ n ][ 2 ] := c )