transform records into dbf

Post Reply
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

transform records into dbf

Post by Silvio.Falconi »

I have a dbf with a field "etnombre"

Image



with capitalized record. Is there a function to convert all records in lower case? except of course the first letter which must remain in uppercase

Code: Select all

#include "Fivewin.ch"


Function Test()
cDesc:= ""
use soggetti alias so

GO TOP 

Do while ! so->(eof())
      

          cDesc :=  Stringlower( so->etnombre, " ")

replace so->etnombre with cDesc

so->(Dbskip())
Enddo
  xbrowse()
  return nil

//------------------------------------------------------//

STATIC  FUNCTION Stringlower( string, parser )
Local cStr:= "", nLenPar:= Len( parser )
Local commapos := 0

   If parser == NIL .OR. parser == "e"
     parser := " "
   EndIf

   Do While Len( string ) > 0
      commapos := at( parser, string )
      IF commapos > 0
         cStr+= Lower(Left( string, commapos - 1 )) + " "
         string := Lower(SubStr( string, commapos + Len( parser ) ))
     ELSE
         cStr+= string
         string := ''
     ENDIF
  ENDDO

RETURN( cStr )
 
But I hae all record on lower case as you can see on this picture

Image

I wish Have the first letter on uppercase
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: transform records into dbf ( resolved)

Post by Silvio.Falconi »

resolved

Code: Select all

 
#include "Fivewin.ch"


Function Test()
   cDesc:= ""
   cDesc2:= ""
   cFirst :=""
   cStringa := ""
use soggetti alias so

GO TOP 

Do while ! so->(eof())
      
   cDesc := so->etnombre
   nLen:=Len(cDesc)
   cFirst := Upper(Left(cDesc,1))

   cDesc2 :=  Right(Stringlower( cDesc, " "),nLen-1)


   cStringa:= cFirst+cDesc2

replace so->etnombre with cStringa

so->(Dbskip())
Enddo
  xbrowse()
  return nil

//------------------------------------------------------//

STATIC  FUNCTION Stringlower( string, parser )
Local cStr:= "", nLenPar:= Len( parser )
Local commapos := 0

   If parser == NIL .OR. parser == "e"
     parser := " "
   EndIf

   Do While Len( string ) > 0
      commapos := at( parser, string )
      IF commapos > 0
         cStr+= Lower(Left( string, commapos - 1 )) + " "
         string := Lower(SubStr( string, commapos + Len( parser ) ))
     ELSE
         cStr+= string
         string := ''
     ENDIF
  ENDDO

RETURN( cStr )


 
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: transform records into dbf

Post by nageswaragunupudi »

Same thing can be done with one line of program

Code: Select all

   GO TOP
   DBEVAL( { || FIELD->ETNOMBRE := TokenUpper( Lower( FIELD->ETNOMBRE ) ) } )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: transform records into dbf

Post by Marc Venken »

nageswaragunupudi wrote:Same thing can be done with one line of program

Code: Select all

   GO TOP
   DBEVAL( { || FIELD->ETNOMBRE := TokenUpper( Lower( FIELD->ETNOMBRE ) ) } )
 
I've seen you using this kind of functions many time

DBEVAL()
AEVAL()

On the FW Wiki they are not listed
On Harbour I only see AEVAL()

TokenUpper() I'v also not found.

Where is the right location of finding ALL RECENT functions of FW?
Marc Venken
Using: FWH 20.08 with Harbour
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: transform records into dbf

Post by nageswaragunupudi »

All these functions are from (x)Harbour. Not FWH.
These functions have been there from the times of 16-bit Clipper days.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 4956
Joined: Thu Oct 18, 2012 7:17 pm

Re: transform records into dbf

Post by Silvio.Falconi »

thanks I allready resolved
I use : FiveWin for Harbour August 2020 (Revision) - Harbour 3.2.0dev (r1712141320) - Bcc7.30 - xMate ver. 1.15.3 - PellesC
ADutheil
Posts: 352
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: transform records into dbf

Post by ADutheil »

Marc Venken wrote:Where is the right location of finding ALL RECENT functions of FW?
Have a look at: https://harbour.github.io/doc/
Regards,

André Dutheil
FWH 13.04 HB 3.2 BCC 5.82 MinGW 4.5.2 MSVS 10
User avatar
Marc Venken
Posts: 727
Joined: Tue Jun 14, 2016 7:51 am

Re: transform records into dbf

Post by Marc Venken »

Ok. Thanks.
Marc Venken
Using: FWH 20.08 with Harbour
Post Reply