to Nages : probl..FW_ArrayToDbf with tdatabase - RESOLVED!!

to Nages : probl..FW_ArrayToDbf with tdatabase - RESOLVED!!

Postby Silvio.Falconi » Sat Jan 26, 2019 12:20 pm

Mr Nages,

I not understood why it save bad

I open oServizi
oServizi:= TServizi():new()
oServizi:gotop()

at init I have this dbf
Image



and I have this dialog

Image

the services on first xbrowse are single, the services on second xbrowse are Multi

Services 1,2,3,4 are single and have the field multiple = .f. and have the field struttura empty
services 5,6,7 are Multi and have the field multiple = .t. and have the field struttura with words


then open the order function and I see it

Image



Now I try to move servizi7 to top

Image




Now save and return to my dialog

Image



ERROR
as you can see there is something of wrong

there are two record "servizi7" one on first xbrowse the other on second xbrowse

the record "Servizi1" now is on second xbrowse while it must be on first xbrowse because it is single service

then If you see the dbf you can see the error

Image



the service have ID 0001 "Servizi1" now have the filed "struttura" full ( instead empty) and the field multiple now is .t. ( instead .f.)

WHY ?


this is the code

Code: Select all  Expand view

Function Order(oBrw1,oBrw2,cFilter1,cfilter2,oServizi)
  local aArray,oLbx,oFont
  local cFieldList:="id,name,breve,price,image,struttura,unit,a4,pos,multiple,islock,ordine"
  local oDlgOrder
  Local cCursor:= TCursor():New(,'HAND')

      oServizi:GOTOP()
      aArray    := oServizi:FW_DbfToArray( cFieldList )


  DEFINE FONT oFont NAME "VERDANA" SIZE 0,-14
  DEFINE DIALOG oDlgOrd   SIZE 600, 480 ;
  TITLE " Cambia la posizione"


            @ 5, 2 XBROWSE  oLbx OF oDlgOrd ;
            DATASOURCE  aArray  ;
            COLUMNS 5,2 ;
            HEADERS "Servizio","Desc" ;
            SIZE 200,210 PIXEL FONT oFont

               WITH OBJECT  oLbx
                         WITH OBJECT  oLbx:aCols[1]
                               :cDataType     := 'F'
                               :nWidth        := 80
                               :nDataBmpAlign := AL_CENTER
                               :lBmpTransparent := .T.
                            END
                      :lheader:=.f.
                      :nMarqueeStyle       := MARQSTYLE_HIGHLWIN7
                      :lHscroll         := .F.
                      :l2007            := .F.
                      :l2015            := .T.
                      :nStretchCol  := STRETCHCOL_WIDEST
                      :lAllowRowSizing     := .F.
                      :lAllowColSwapping   := .F.
                      :lAllowColHiding     := .F.
                      :lRecordSelector     := .F.
                      :CreateFromCode()
                   END


   @ 22,208 BTNBMP oBtnUp    PROMPT "&UP" ;
               RESOURCE "BTN_PNG_SCROLLUP" FLAT;
               SIZE 80,25 LEFT PIXEL OF  oDlgOrd  ;
               ACTION  oLbx:SwapUp()
               
   @ 72,208 BTNBMP oBtnDown PROMPT "&Down" ;
              RESOURCE "BTN_PNG_SCROLLDOWN" FLAT;
              SIZE 80,25 LEFT  PIXEL OF  oDlgOrd;
              ACTION oLbx:SwapDn()
                       

   @ 122,208 BTNBMP oBtnOrdine    PROMPT "&Save" ;
               RESOURCE "BTN_PNG_SAVE" FLAT;
               SIZE 80,25 LEFT PIXEL OF  oDlgOrd ;
               ACTION oDlgOrd:end( IDOK )
                             

   @ 162,208 BTNBMP oBtnUscita    PROMPT "&Exit" ;
               RESOURCE "BTN_PNG_USCITA" FLAT;
               SIZE 80,25 LEFT PIXEL OF  oDlgOrd  ;
               ACTION oDlgOrd:end( IDCANCEL )
                             


             oBtnUp:oCursor:= cCursor
             oBtnDown:oCursor:= cCursor
             oBtnOrdine:oCursor:= cCursor
             oBtnUscita:oCursor:= cCursor


      ACTIVATE DIALOG oDlgOrd CENTER
      if oDlgOrd:nresult == IDOK

                   //save the poistion on records of array
                    AEval( aArray, { |a,i| a[ 12 ] := i } )

                 // save the oServizi
                 oServizi:GOTOP()
                 aArray    := oServizi:FW_ArrayToDbf( aArray, cFieldList, nil, .T. )
                 oServizi:GOTOP()

            Endif



    //refresh the xbrowses

      if oBrw1 != nil
          IF !empty(cFilter1)
            (oBrw1:cAlias)->(DbSetFilter( {|| &cFilter1  },  ))
            (oBrw1:cAlias)->(DBGOTOP())
           ENDIF
        oBrw1:Refresh(.t.)
        oBrw1:SetFocus( .t. )
    endif

    if oBrw2 != nil
        IF !empty(cFilter2)
           (oBrw2:cAlias)->(DbSetFilter( {|| &cFilter2  },  ))
          (oBrw2:cAlias)->(DBGOTOP())
         ENDIF
        oBrw2:Refresh(.t.)
        oBrw2:SetFocus( .t. )
   endif

   RETURN NIL
Last edited by Silvio.Falconi on Wed Jan 30, 2019 7:52 am, edited 2 times in total.
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby James Bott » Mon Jan 28, 2019 5:42 pm

There is no method FW_DbfToArray( cFieldList ) of TDatabase.

aArray := oServizi:FW_DbfToArray( cFieldList )


Try:

aArray := oServizi:cAlias->(FW_DBFToArray( cFieldList ))
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby Silvio.Falconi » Mon Jan 28, 2019 5:52 pm

oServizi:GOTOP()
aArray := (oServizi:cAlias)->(FW_ArrayToDbf( aArray, cFieldList, nil, .T. ))
oServizi:GOTOP()

give me the same error
two record with "servizi7"
Image
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby James Bott » Mon Jan 28, 2019 7:03 pm

Did you check to see if there are actually two records with the same name?
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby nageswaragunupudi » Tue Jan 29, 2019 1:46 am

James Bott wrote:There is no method FW_DbfToArray( cFieldList ) of TDatabase.

aArray := oServizi:FW_DbfToArray( cFieldList )


Both
Code: Select all  Expand view
aArray := oServizi:FW_DbfToArray( cFieldList )
// and
aArray := oServizi:DbfToArray( cFieldList )
 

work and work the same way.

Here is a sample to test:
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

function Main()

   local oDbf, aArray1, aArray2

   oDbf  := TDatabase():Open( , "STATES", "DBFCDX", .T. )
   if oDbf:Used()

      oDbf:GoTop()
      aArray1 := oDbf:FW_DbfToArray( "RECNO(),CODE,NAME" )

      oDbf:GoTop()
      aArray2 := oDbf:DbfToArray( "CODE,NAME" )

      XBROWSER aArray1
      XBROWSER aArray2

   endif

   oDbf  := nil

return nil
 


James Bott wrote:Try:

aArray := oServizi:cAlias->(FW_DBFToArray( cFieldList ))


I am afraid the syntax is not correct.
It should be:
Code: Select all  Expand view
aArray := ( oServizi:cAlias )->( FW_DbfToArray( cFieldList ) )
 
Regards

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

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby Silvio.Falconi » Tue Jan 29, 2019 7:50 am

RAO
the problem is when it go to save

I tried with

aArray := oServizi:FW_ArrayToDbf( aArray, cFieldList, nil, .T. )

or

aArray := (oServizi:cAlias)->(FW_ArrayToDbf( aArray, cFieldList, nil, .T. ))

I'm afraid Tdata of JAmes not run well because I tried your sample ( with states.dbf) and it run ok
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby nageswaragunupudi » Tue Jan 29, 2019 9:05 am

I'm afraid Tdata of JAmes not run well

The problem can not be with TData class.
It must be with your program somewhere.
Regards

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

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby Silvio.Falconi » Tue Jan 29, 2019 9:14 am

Rao,
I tried also with tdatabase and not run ok

First
Image

please see the "0004" first column and 6th column

then open the dialog to change the position

Image


now I move the last record to top
Image

Now I check the database
Image

the Seven record is moved but there is an error ...
please see the 0004 ( first column) it have the 6th colum full and the field multiple = .t. instead .f.




please see it (it is your test I add my servizi.dbf and dialog to change position)
Code: Select all  Expand view

#include "fivewin.ch"

REQUEST DBFCDX

function Main()
   local oDlg,oLbx
    Local oBtnUp,oBtnDown,oBtnOrdine,oBtnUscita

   local oDbf, aArray1, aArray2
   local cFieldList:="id,name,breve,price,image,struttura,unit,a4,pos,multiple,islock,ordine"


   oDbf  := TDatabase():Open( , "SERVIZI", "DBFCDX", .T. )
   
if oDbf:Used()


      oDbf:GoTop()
      aArray1 := oDbf:FW_DbfToArray( cFieldList )


  DEFINE FONT oFont NAME "VERDANA" SIZE 0,-14
  DEFINE DIALOG oDlg   SIZE 600, 480 ;
  TITLE " Change the position"

      @ 5, 2 XBROWSE  oLbx OF oDlg ;
            DATASOURCE  aArray1 ;
            COLUMNS 5,2 ;
            HEADERS "Servizio","Desc" ;
            SIZE 200,210 PIXEL FONT oFont


                 WITH OBJECT  oLbx
                         WITH OBJECT  oLbx:aCols[1]
                               :cDataType     := 'F'
                               :nWidth        := 80
                               :nDataBmpAlign := AL_CENTER
                               :lBmpTransparent := .T.
                            END
                      :lheader:=.f.
                      :nMarqueeStyle       := MARQSTYLE_HIGHLWIN7
                      :lHscroll         := .F.
                      :l2007            := .F.
                      :l2015            := .T.
                      :nStretchCol  := STRETCHCOL_WIDEST
                      :lAllowRowSizing     := .F.
                      :lAllowColSwapping   := .F.
                      :lAllowColHiding     := .F.
                      :lRecordSelector     := .F.
                      :CreateFromCode()
                   END



 @ 22,208 BTNBMP oBtnUp    PROMPT "&UP" ;
               RESOURCE "BTN_PNG_SCROLLUP" FLAT;
               SIZE 80,25 LEFT PIXEL OF  oDlg  ;
               ACTION  oLbx:SwapUp()
               
   @ 72,208 BTNBMP oBtnDown PROMPT "&Down" ;
              RESOURCE "BTN_PNG_SCROLLDOWN" FLAT;
              SIZE 80,25 LEFT  PIXEL OF  oDlg;
              ACTION oLbx:SwapDn()
                       

   @ 122,208 BTNBMP oBtnOrdine    PROMPT "&Save" ;
               RESOURCE "BTN_PNG_SAVE" FLAT;
               SIZE 80,25 LEFT PIXEL OF  oDlg ;
               ACTION oDlg:end( IDOK )
                             
   @ 162,208 BTNBMP oBtnUscita    PROMPT "&Exit" ;
               RESOURCE "BTN_PNG_USCITA" FLAT;
               SIZE 80,25 LEFT PIXEL OF  oDlg ;
               ACTION oDlg:end( IDCANCEL )
                               
           


      ACTIVATE DIALOG oDlg CENTER

 if oDlg:nresult == IDOK
         AEval( aArray1, { |a,i| a[ 12 ] := i } )

                 oDbf:GoTop()
                 aArray1    := oDbf:FW_ArrayToDbf( aArray1, cFieldList, nil, .T. )
                 oDbf:GoTop()

endif


      oDbf:GoTop()
      aArray2 := oDbf:DbfToArray( cFieldList )
      XBROWSER aArray2

endif

   oDbf  := nil

return nil







 



It change the position of the record I moved but it change also the the content of the fourth record (in this case) in the sixth column and the multiple field, changing it from F to T


Use this if you want create my dbf ( with sample data)

Code: Select all  Expand view
Function BuildDbf()
   local aCols       := { ;
                     { "id"    , "C",    4, 0 },;
                     { "name"  , "C",   30, 0 },;
                     { "breve"  , "C",  10, 0 },;
                     { "price" , "N",    9, 2 },;
                     { "image" , "C",   30, 0 },;
                     { "struttura","C", 30, 0 },;
                     { "unit"  , "N",    4, 0 },;
                     { "a4"    , "L",    1, 0 },;
                     { "pos"   , "L",    1, 0 },;
                     { "multiple", "L",  1, 0 },;
                     { "islock"  , "L",  1, 0 },;
                     { "ordine"  , "N",  2, 0 } }

 //sample data
   local aData       := { ;
{ "0001","Lettino","ser1",10,".\images\1.png","",100,.t.,.t.,.f.,.t.,1 }, ;
{ "0002","Sdraio","ser2",10,".\images\2.png","",100,.t.,.t.,.f.,.t.,2 }, ;
{ "0003","Regista","ser3",10,".\images\3.png","",100,.t.,.t.,.f.,.t.,3 }, ;
{ "0004","Parcheggio","parcheggio",10,".\images\4.png","",100,.t.,.t.,.f.,.t.,4 }, ;
{ "0005","Lettino+sdrario+regista","ser5",18,".\images\5.png","[lettino][sdraio][regista]",0,.t.,.t.,.t.,.t.,5 }, ;
{ "0006","sdrario+lettino","ser6",12,".\images\6.png","[sdraio][lettino]",0,.t.,.t.,.t.,.t.,6 }, ;
{ "0007","regista+lettino","ser7",16,".\images\7.png","[regista][lettino]",0,.t.,.t.,.t.,.t.,7 } }


DBCREATE( "SERVIZI.DBF", aCols, "DBFCDX", .T. )
   FW_ArrayToDBF( aData )
   CLOSE DATA



USE Servizi.dbf NEW VIA "DBFCDX"

INDEX ON ID TAG SE001 FOR !Deleted()
INDEX ON upper(NAME) TAG SE002 FOR !Deleted()
INDEX ON ORDINE TAG SE003 FOR !Deleted()

CLOSE DATA
RETURN NIL






 



you sad "It must be with your program somewhere." ok but where ?
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby nageswaragunupudi » Wed Jan 30, 2019 12:57 am

Mr. Silvio

you sad "It must be with your program somewhere." ok but where ?


You are right. I am wrong.
I sent you revised lib. Please test with the revised lib.
Regards

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

Re: to Nages : problem with FW_ArrayToDbf with tdatabase

Postby Silvio.Falconi » Wed Jan 30, 2019 7:50 am

YOU're FANTASTIC

NOW RUN OK

Image
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages : probl..FW_ArrayToDbf with tdatabase - RESOLVED!!

Postby nageswaragunupudi » Wed Jan 30, 2019 8:21 am

Your main objective is to swap records in servizi.dbf.

For this purpose, you are copying the data into an array, swapping array elements and then copy the array back to the dbf.

All that is not necessary. You can swap the records in the dbf directly and forget about copying to and from array.

Test this sample code:
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

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

function Main()

   local oDlg, oBrw, oFont, oServizi
   local cSwapFields:="id,name,breve,price,image,struttura,unit,a4,pos,multiple,islock" //,ordine"

   SET DELETED ON

   BuildDBF()

   USE SERVIZI NEW SHARED VIA "DBFCDX"
   OrdSetFocus( 0 )
   GO TOP

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
   DEFINE DIALOG oDlg SIZE 900,300 PIXEL TRUEPIXEL FONT oFont TITLE "SERVIZI.DBF"
   @ 70,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "SERVIZI" AUTOCOLS ;
      LINES NOBORDER

   WITH OBJECT oBrw
      :nMarqueeStyle       := MARQSTYLE_HIGHLROW
      :AutoFit()
      :SetChecks()
      :bChange          := { || oDlg:AEvalWhen() }
      //
      :CreateFromCode()
   END

   @ 15, 20 BUTTON "ADD"  SIZE 100,40 PIXEL OF oDlg ACTION ( oBrw:cAlias )->( AddRec( oBrw ) )
   @ 15,240 BUTTON "UP"   SIZE 100,40 PIXEL OF oDlg ;
      WHEN oBrw:KeyNo > 1 ;
      ACTION ( ( oBrw:cAlias )->( SwapRec( VK_UP, cSwapFields ) ), oBrw:Refresh(), oBrw:SetFocus() )
   @ 15,350 BUTTON "DOWN" SIZE 100,40 PIXEL OF oDlg ;
      WHEN oBrw:KeyNo < oBrw:nLen ;
      ACTION ( ( oBrw:cAlias )->( SwapRec( VK_DOWN, cSwapFields ) ), oBrw:Refresh(), oBrw:SetFocus() )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

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

static function SwapRec( nKey, cList )

   local nRec, aRows

   if nKey == VK_UP
      DBSKIP( -1 )
      if BOF()
         DBGOTOP()
      else
         nRec     := RECNO()
         aRows    := FW_DbfToArray( cList, nil, nil, 2 )
         DBGOTO( nRec )
         if Len( aRows ) == 2
            AINS( aRows, 1, aRows[ 2 ] )
            FW_ArrayToDBF( aRows, cList, nil, .T. )
            DBGOTO( nRec )
         endif
      endif
   elseif nKey == VK_DOWN
      nRec     := RECNO()
      aRows    := FW_DbfToArray( cList, nil, nil, 2 )
      DBGOTO( nRec )
      if Len( aRows ) == 2
         AINS( aRows, 1, aRows[ 2 ] )
         FW_ArrayToDBF( aRows, cList, nil, .T. )
         DBGOTO( nRec )
         DBSKIP( 1 )
      endif
   endif

return nil

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

static function AddRec( oBrw )

   local oRec  := TDataRow():New( Alias(),, .t. )

   oRec:oBrw   := oBrw
   oRec:SetDefault( "ORDINE", { || LASTREC() + 1 }, .F. )
   oRec:Edit()

return nil

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

Function BuildDbf()

   field ID,NAME,ORDINE

   local aCols       := { ;
                     { "id"    , "C",    4, 0 },;
                     { "name"  , "C",   30, 0 },;
                     { "breve"  , "C",  10, 0 },;
                     { "price" , "N",    9, 2 },;
                     { "image" , "C",   30, 0 },;
                     { "struttura","C", 30, 0 },;
                     { "unit"  , "N",    4, 0 },;
                     { "a4"    , "L",    1, 0 },;
                     { "pos"   , "L",    1, 0 },;
                     { "multiple", "L",  1, 0 },;
                     { "islock"  , "L",  1, 0 },;
                     { "ordine"  , "N",  2, 0 } }

 //sample data
   local aData       := { ;
{ "0001","Lettino","ser1",10,".\images\1.png","",100,.t.,.t.,.f.,.t.,1 }, ;
{ "0002","Sdraio","ser2",10,".\images\2.png","",100,.t.,.t.,.f.,.t.,2 }, ;
{ "0003","Regista","ser3",10,".\images\3.png","",100,.t.,.t.,.f.,.t.,3 }, ;
{ "0004","Parcheggio","parcheggio",10,".\images\4.png","",100,.t.,.t.,.f.,.t.,4 }, ;
{ "0005","Lettino+sdrario+regista","ser5",18,".\images\5.png","[lettino][sdraio][regista]",0,.t.,.t.,.t.,.t.,5 }, ;
{ "0006","sdrario+lettino","ser6",12,".\images\6.png","[sdraio][lettino]",0,.t.,.t.,.t.,.t.,6 }, ;
{ "0007","regista+lettino","ser7",16,".\images\7.png","[regista][lettino]",0,.t.,.t.,.t.,.t.,7 } }

DBCREATE( "SERVIZI.DBF", aCols, "DBFCDX", .T. )

FW_ArrayToDBF( aData )

INDEX ON ID TAG SE001 FOR !Deleted()
INDEX ON upper(NAME) TAG SE002 FOR !Deleted()
INDEX ON ORDINE TAG SE003 FOR !Deleted()

CLOSE DATA
RETURN NIL
 


Image
Regards

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

Re: to Nages : probl..FW_ArrayToDbf with tdatabase - RESOLVED!!

Postby Silvio.Falconi » Wed Jan 30, 2019 9:32 am

Wonderful, I also tried it in the main program.
this thing is very useful for ordering the most used products to display in a look up for an order
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages : probl..FW_ArrayToDbf with tdatabase - RESOLVED!!

Postby Silvio.Falconi » Wed Jan 30, 2019 5:57 pm

Now I kill myself...
I try the test also with another dbf ( elementi.dbf) I sent you
and with tdatabase features and I have problems

1. If I take the first record and move it down it is not fast and each time I must reselect the row I wish to move down
2. it not change the field ElOrdine ( the number is allways the same)

If I change dbf and the cSwapFields I must change another thing ?

Image
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: to Nages : probl..FW_ArrayToDbf with tdatabase - RESOLVED!!

Postby nageswaragunupudi » Wed Jan 30, 2019 6:25 pm

and with tdatabase features and I have problems

The sample I posted is for DBF. Not for TDatabase.

1. If I take the first record and move it down it is not fast and each time I must reselect the row I wish to move down

Do not use WIN7 marqueestyle.

2. it not change the field ElOrdine ( the number is allways the same)

Obviously.
Changes only the fields contained in cSwapFields.
Does not change fields no contained in cSwapFields.
You decide what fields you want to swap

Note:
Keep the DBF in natural order ( OrdSetFocus( 0 ) )
Regards

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

Re: to Nages : probl..FW_ArrayToDbf with tdatabase - RESOLVED!!

Postby Silvio.Falconi » Wed Jan 30, 2019 7:40 pm

Nages,

I insert the field of Elementi.dbf into cSwapFields:
Code: Select all  Expand view

 local cSwapFields:="ELNUMERO,ELORDINE,ELNOME,ELCOLORE,ELATTIVO,ELIMGLIB,ELIMGOCC,ELIMGALT,ELLOCK"



I use
Code: Select all  Expand view
:nMarqueeStyle       := MARQSTYLE_HIGHLROW


I think the problem is tdatabase

Code: Select all  Expand view
   oElementi:= TDatabase():New(,"Elementi",,.f.)
    oElementi:use()
    oElementi:setorder(0)


How we resolve if I open the dbf with tdatabase ?
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests