fwdbu request

fwdbu request

Postby Silvio.Falconi » Sun Mar 25, 2018 1:46 pm

it is possible add to the function TxtStruct( oBrw ) of fivedbu the list of index and key expression and for expression .


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

Re: fwdbu request

Postby Otto » Mon Mar 26, 2018 6:44 am

Hello Silvio,
this is a very useful practical feature. Thank you for asking.
Best regards,
Otto


Code: Select all  Expand view
function TxtStruct( oBrw )

   local cCode := "local aFields := { ", n, bClipboard
    local   cIndexCode := "     Indexes in use " + Space( 23 ) + "TagName" + CRLF
    local J := 0
   *----------------------------------------------------------
   
    for j = 1 to 15

        if ! Empty( ( Alias( n ) )->( IndexKey( j ) ) )
            cIndexCode += Space( 8 ) + ;
            If( ( Alias( n ) )->( IndexOrd() ) == j, "=> ", "   " ) + ;
            PadR( ( Alias( n ) )->( IndexKey( j ) ), 35 ) + ;
            ( Alias( n ) )->( OrdName( j ) ) + ;
            CRLF
        endif
   next

   if Empty( oBrw:oRs )
        for n = 1 to FCount()
         if n > 1
            cCode += Space( 19 )
         endif
         cCode += '{ "' + FieldName( n ) + '", "' + ;
                  FieldType( n ) + '", ' + ;
                  AllTrim( Str( FieldLen( n ) ) ) + ", " + ;
                  AllTrim( Str( FieldDec( n ) ) ) + " },;" + CRLF
      next
   else
      for n = 1 to oBrw:oRS:Fields:Count
         if n > 1
            cCode += Space( 19 )
         endif
         cCode += '{ "' + oBrw:oRS:Fields[ n - 1 ]:Name + '", "' + ;
                  FWAdoFieldType( oBrw:oRs, n ) + '", ' + ;
                  AllTrim( Str( FWAdoFieldSize( oBrw:oRs, n ) ) ) + ", " + ;
                  AllTrim( Str( FWAdoFieldDec( oBrw:oRs, n ) ) ) + ;
                  " },;" + CRLF
      next
   endif  

   cCode = SubStr( cCode, 1, Len( cCode ) - 4 ) + " }" + CRLF + CRLF

   if Empty( oBrw:oRs )
      cCode += 'DbCreate( "myfile.dbf", aFields, "' + RddName() + '" )'
   endif  

    cCode += CRLF + cIndexCode

   bClipboard = { | oDlg | AddClipboardButton( oDlg ), cCode }

   MemoEdit( bClipboard, FWString( "Code" ) )

return nil

//----------------------------------------------------------------------------//
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6304
Joined: Fri Oct 07, 2005 7:07 pm

Re: fwdbu request

Postby Antonio Linares » Mon Mar 26, 2018 9:26 am

Thanks Otto :-)

I think this is a better implementation as it writes the code that we need to create the indexes ;-) :
Code: Select all  Expand view
function TxtStruct( oBrw )

   local cCode := "local aFields := { ", n, bClipboard

   if Empty( oBrw:oRs )
        for n = 1 to FCount()
         if n > 1
            cCode += Space( 19 )
         endif
         cCode += '{ "' + FieldName( n ) + '", "' + ;
                  FieldType( n ) + '", ' + ;
                  AllTrim( Str( FieldLen( n ) ) ) + ", " + ;
                  AllTrim( Str( FieldDec( n ) ) ) + " },;" + CRLF
      next
   else
      for n = 1 to oBrw:oRS:Fields:Count
         if n > 1
            cCode += Space( 19 )
         endif
         cCode += '{ "' + oBrw:oRS:Fields[ n - 1 ]:Name + '", "' + ;
                  FWAdoFieldType( oBrw:oRs, n ) + '", ' + ;
                  AllTrim( Str( FWAdoFieldSize( oBrw:oRs, n ) ) ) + ", " + ;
                  AllTrim( Str( FWAdoFieldDec( oBrw:oRs, n ) ) ) + ;
                  " },;" + CRLF
      next
   endif  

   cCode = SubStr( cCode, 1, Len( cCode ) - 4 ) + " }" + CRLF + CRLF

   if Empty( oBrw:oRs )
      cCode += 'DbCreate( "myfile.dbf", aFields, "' + RddName() + '" )'
   endif  

   for n = 1 to 15
      if ! Empty( ( Alias() )->( IndexKey( n ) ) )
         cCode += CRLF + CRLF + "INDEX ON " + ( Alias() )->( IndexKey( n ) ) + " TO " + ;
                  ( Alias() )->( OrdName( n ) )
      endif
   next

   bClipboard = { | oDlg | AddClipboardButton( oDlg ), cCode }

   MemoEdit( bClipboard, FWString( "Code" ) )

return nil


See the result for FWH\samples\aswapt.dbf:
Code: Select all  Expand view
local aFields := { { "APTCLI", "C", 40, 0 },;
                   { "APTVEH", "C", 40, 0 },;
                   { "APTDAT", "D", 8, 0 },;
                   { "APTBTI", "C", 5, 0 },;
                   { "APTETI", "C", 5, 0 },;
                   { "APTDUR", "N", 5, 0 },;
                   { "APTACN", "C", 6, 0 },;
                   { "APTLIC", "C", 12, 0 },;
                   { "APTQUO", "C", 8, 0 },;
                   { "APTASG", "C", 20, 0 },;
                   { "APTUSD", "L", 1, 0 },;
                   { "APTUID", "C", 12, 0 },;
                   { "APTCLR", "C", 2, 0 },;
                   { "APTREM", "L", 1, 0 },;
                   { "APTBEG", "C", 18, 0 },;
                   { "APTEND", "C", 18, 0 },;
                   { "APTPHO", "C", 18, 0 },;
                   { "APTNOT", "M", 10, 0 },;
                   { "APTSUM", "C", 60, 0 },;
                   { "APTITV", "N", 4, 0 },;
                   { "APTSEQ", "N", 12, 0 },;
                   { "APTRON", "L", 1, 0 },;
                   { "APTALD", "L", 1, 0 },;
                   { "APTMTG", "L", 1, 0 },;
                   { "APTPRI", "L", 1, 0 },;
                   { "APTIMP", "N", 1, 0 },;
                   { "APTBSY", "N", 1, 0 } }

DbCreate( "myfile.dbf", aFields, "DBFCDX" )

INDEX ON dtos(aptdat)+aptbti TO ASWAPT

INDEX ON aptasg+dtos(aptdat)+aptbti TO ASWAPU

INDEX ON aptbeg TO ASWBEG

INDEX ON aptuid TO ASWUID


Code: Select all  Expand view
INDEX ON dtos(aptdat)+aptbti TO ASWAPT

INDEX ON aptasg+dtos(aptdat)+aptbti TO ASWAPU

INDEX ON aptbeg TO ASWBEG

INDEX ON aptuid TO ASWUID
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: fwdbu request

Postby Silvio.Falconi » Mon Mar 26, 2018 9:29 am

Antonio,
and the tags ?
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: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: fwdbu request

Postby Otto » Mon Mar 26, 2018 9:46 am

Dear Antonio,
thank you.

As to show source code is for me one oft he most used functions I inserted a button on the buttonbar for this.
Code: Select all  Expand view
DEFINE BUTTON OF oBar PROMPT FWString( "SourceCode" ) RESOURCE "code" ACTION TxtStruct( oBrw )

Also the question “Do you want to end” I deleted.
Code: Select all  Expand view
ACTIVATE WINDOW oWndMain MAXIMIZED ;
      VALID ( FWMissingStrings(), .T. ) ;
      ON PAINT DrawTiled( hDC, oWndMain, oBmpTiled )
 

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6304
Joined: Fri Oct 07, 2005 7:07 pm

Re: fwdbu request

Postby Otto » Mon Mar 26, 2018 10:04 am

In my copy I also changed AddClipboardButton:

function AddClipboardButton( oDlg, cText )

local oBtn

@ 238, 6 BUTTON oBtn PROMPT FWString( "Copy to clipboard" ) ;
OF oDlg SIZE 180, 28 PIXEL ;
ACTION ( CopyToClipboard( oDlg:aControls[ 1 ]:GetText() ), oDlg:end() )

return nil

//----------------------------------------------------------------------------//
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6304
Joined: Fri Oct 07, 2005 7:07 pm

Re: fwdbu request

Postby Marc Venken » Mon Mar 26, 2018 10:45 am

In FWDbu there is no option to print the structure on paper ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1417
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: fwdbu request

Postby Antonio Linares » Mon Mar 26, 2018 11:22 am

Marc,

You copy it and paste it on notepad, email, etc
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: fwdbu request

Postby Silvio.Falconi » Mon Mar 26, 2018 11:26 am

Antonio
I not understood

I need also the tag
sample :

INDEX ON upper(last) TAG LAST EVAL (oProgress:SetPos(nProgress++), Sysrefresh()) EVERY 1 FOR ! DELETED()
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: 7016
Joined: Thu Oct 18, 2012 7:17 pm

Re: fwdbu request

Postby Otto » Mon Mar 26, 2018 12:41 pm

Hello Silvio,
I added:

Code: Select all  Expand view

         if    cRDD = "DBFCDX"
         
                cCode += CRLF + CRLF + "INDEX ON " + ( Alias() )->( IndexKey( n ) ) + " TO TAG " + ;
                  ( Alias() )->( OrdName( n ) )
            else
                cCode += CRLF + CRLF + "INDEX ON " + ( Alias() )->( IndexKey( n ) ) + " TO " + ;
                  ( Alias() )->( OrdName( n ) )
           
            endif
 


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6304
Joined: Fri Oct 07, 2005 7:07 pm

Re: fwdbu request

Postby Antonio Linares » Mon Mar 26, 2018 2:32 pm

Silvio,

Code: Select all  Expand view
  for n = 1 to 15
      if ! Empty( ( Alias() )->( IndexKey( n ) ) )
         cCode += CRLF + CRLF + "INDEX ON " + ( Alias() )->( IndexKey( n ) ) + ;
                  If( ( Alias() )->( RddName() ) == "DBFNTX", " TO ", " TAG " ) + ;
                  ( Alias() )->( OrdName( n ) )
      endif
   next
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: fwdbu request

Postby TimStone » Mon Mar 26, 2018 5:31 pm

I'm rather confused by the question ...

I modified the dBU a few years ago, added some features, and have the ability to select an index. My clients have learned to use this "File Editor" effectively.

In the users manual, I added instruction on how to use the editor, plus the structure ( fields, types, sizes, and description of each ), and specify in there the indexes and keys. This way, for someone who actually needs to know what they are looking for, they can check the document and see not only the key, but also the description of each field.

If they are not willing to read the manual, and understand what they are doing, I certainly do not want them using this utility.

I also keep a copy of those structures in One Note. This allows me an instant reference to every file.

Finally, Antonio I noted you mentioned the ASWAPT.dbf. That is the one I created for the calendar implementation using Codejock. Do we have that full implementation in the Samples ?

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: fwdbu request

Postby Antonio Linares » Mon Mar 26, 2018 8:16 pm

Tim,

Today we enhanced the FiveDBU functionality to generate the code to create the index files:
Image

ASWAPT.dbf is provided in FWH\samples. It is used from FWH\samples\schedule.prg
I don't remember when it was placed there (I can check it in FWH repository) but I guess it was an example
that we tested together. If you want me to remove it please let me know it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42052
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: fwdbu request

Postby TimStone » Mon Mar 26, 2018 9:13 pm

Antonio,

Schedule.prg is the program I worked on with two other FW developers, which we shared freely, and it is fine to be in the samples. It uses the Codejock library.

This specific version is pretty enhanced, and is used by most of my clients very heavily. It allows for very detailed appointments, repeating ones, assigning people to them, tracking clients and their service items, color coded work types, and much more. It displays like Outlook, and allows multiple appointments for the same, or overlapping, times.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: fwdbu request

Postby Silvio.Falconi » Tue Mar 27, 2018 6:54 am

Antonio Linares wrote:Silvio,

Code: Select all  Expand view
  for n = 1 to 15
      if ! Empty( ( Alias() )->( IndexKey( n ) ) )
         cCode += CRLF + CRLF + "INDEX ON " + ( Alias() )->( IndexKey( n ) ) + ;
                  If( ( Alias() )->( RddName() ) == "DBFNTX", " TO ", " TAG " ) + ;
                  ( Alias() )->( OrdName( n ) )
      endif
   next


thanks
where is the last version of fwdbu

why not use a class to show dbf window ? type ....class odbfwnd from TXbrowse ?
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: 7016
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 51 guests