transform records into dbf

transform records into dbf

Postby Silvio.Falconi » Sun Jan 15, 2017 2:23 pm

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  Expand view
#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
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: transform records into dbf ( resolved)

Postby Silvio.Falconi » Sun Jan 15, 2017 2:59 pm

resolved
Code: Select all  Expand view

#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 )


 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: transform records into dbf

Postby nageswaragunupudi » Sun Jan 15, 2017 9:19 pm

Same thing can be done with one line of program
Code: Select all  Expand view
  GO TOP
   DBEVAL( { || FIELD->ETNOMBRE := TokenUpper( Lower( FIELD->ETNOMBRE ) ) } )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: transform records into dbf

Postby Marc Venken » Sun Jan 15, 2017 10:46 pm

nageswaragunupudi wrote:Same thing can be done with one line of program
Code: Select all  Expand view
  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 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: transform records into dbf

Postby nageswaragunupudi » Sun Jan 15, 2017 10:58 pm

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
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: transform records into dbf

Postby Silvio.Falconi » Mon Jan 16, 2017 12:05 pm

thanks I allready resolved
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
Silvio.Falconi
 
Posts: 7034
Joined: Thu Oct 18, 2012 7:17 pm

Re: transform records into dbf

Postby ADutheil » Mon Jan 16, 2017 1:37 pm

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 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: transform records into dbf

Postby Marc Venken » Mon Jan 16, 2017 11:02 pm

Ok. Thanks.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1425
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests