WorkSpaceList()

WorkSpaceList()

Postby Jimmy » Wed May 31, 2023 11:39 pm

hi,

is there a Fivewin Function like Xbase++ WorkSpaceList() :?:

i want to know which DBF are open and ALIAS() in a Thread
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1699
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: WorkSpaceList()

Postby nageswaragunupudi » Thu Jun 01, 2023 2:21 am

Code: Select all  Expand view
aGetWorkAreas() //--> Array of Alias names.


For more information, we may make our own function on these lines:
Code: Select all  Expand view
for n := 1 to 255
if !Empty( cAlias := Alias( n ) )
   AAdd( aAreas, { n, cAlias, (n)->(DBINFO(DBI_FULLPATH))} ) // more information we want
endif
next
Regards

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

Re: WorkSpaceList()

Postby Marc Venken » Thu Jun 01, 2023 7:09 am

Code: Select all  Expand view


SETKEY( VK_F12, { | nKey | DBFTONEN() } ) // ??  Quick way of showing me the open dbf's etc.

FUNCTION dbftonen() // ??  This is showing me in debug mode what file are open

   LOCAL n, j, nTarget
   LOCAL cErrorlog := ""

   cErrorLog += CRLF + "DataBases in use" + CRLF + "================" + CRLF

   FOR n = 1 TO 255
      IF ! Empty( Alias( n ) )

         cErrorLog += CRLF + Str( n, 3 ) + ": " + If( Select() == n, "=> ", "   " ) + ;
            ( Alias( n ) )->( dbInfo( DBI_FULLPATH ) ) + Space( 2 ) + "RddName: " + ;
            ( Alias( n ) )->( rddName() ) + CRLF
         cErrorLog += "     =======================================================" + CRLF
         cErrorLog += "     RecNo    RecCount    BOF   EOF" + CRLF
         cErrorLog += "   " + Transform( ( Alias( n ) )->( RecNo() ), "9999999" ) + ;
            "     " + Transform( ( Alias( n ) )->( RecCount() ), "9999999" ) + ;
            "    " + cValToChar( ( Alias( n ) )->( Bof() ) ) + ;
            "   " + cValToChar( ( Alias( n ) )->( Eof() ) ) + Transform( ( Alias( n ) )->( ordKeyCount() ), "9999999" )  + CRLF + CRLF
         IF ( Alias( n ) )->( rddName() ) != "ARRAYRDD"
            cErrorLog += "     Indexes in use " + Space( 23 ) + "TagName" + CRLF + CRLF
            FOR j = 1 TO 25
               IF ! Empty( ( Alias( n ) )->( IndexKey( j ) ) )
                  cErrorLog += Space( 8 ) + ;
                     If( ( Alias( n ) )->( IndexOrd() ) == j, "=> ", "   " ) + ;
                     PadR( ( Alias( n ) )->( IndexKey( j ) ), 35 ) + ;
                     ( Alias( n ) )->( ordName( j ) ) + ;
                     CRLF
               ENDIF
            NEXT
            cErrorLog += CRLF + "     Alias Name : "+ Alias(n) + CRLF + CRLF
            cErrorLog += CRLF + "     Filters set : " + (alias(n))->(dbfilter())+ CRLF + CRLF
            cErrorLog += CRLF + "     Relations in use" + CRLF + CRLF
            FOR j = 1 TO 8
               IF ! Empty( ( nTarget := ( Alias( n ) )->( dbRSelect( j ) ) ) )
                  cErrorLog += Space( 3 ) + Str( j ) + ": " + ;
                     "TO " + ( Alias( n ) )->( dbRelation( j ) ) + ;
                     " INTO " + Alias( nTarget ) + CRLF
                  // uValue = ( Alias( n ) )->( DbRelation( j ) )
                  // cErrorLog += cValToChar( ordsetfocus( uValue ) ) + CRLF
               ENDIF
            NEXT

         ENDIF

      ENDIF
   NEXT
   //FW_memoEdit(cErrorlog)
   FW_MemoEdit( cErrorlog, "Geopende Databases", 10, 60, 60, 150 )

RETURN NIL

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

Re: WorkSpaceList()

Postby nageswaragunupudi » Thu Jun 01, 2023 7:21 am

Mr. Marc
This is an extract from "errorsysw.prg"
Regards

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

Re: WorkSpaceList()

Postby Marc Venken » Thu Jun 01, 2023 7:46 am

Yes indeed,

But just to see what is open while running the program. Can be handy for debugging.

aahh.. I forgot to mention that it is source from FW-Team. Sorry
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1397
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: WorkSpaceList()

Postby karinha » Thu Jun 01, 2023 12:08 pm

Marc,

Code: Select all  Expand view

FUNCTION dbftonen() // ??  This is showing me in debug mode what file are open

   LOCAL n, j, nTarget, cErrorlog := "", cText, oPrn, oFont
   LOCAL lPdfImp := .F. // Genera o no el *.PDF
   LOCAL nRow, nCol

   cErrorLog += CRLF + "DataBases in use" + CRLF + "================" + CRLF

   FOR n = 1 TO 255

      IF .NOT. Empty( Alias( n ) )

         cErrorLog += CRLF + Str( n, 3 ) + ": " + If( Select() == n, "=> ", "   " ) + ;
            ( Alias( n ) )->( dbInfo( DBI_FULLPATH ) ) + Space( 2 ) + "RddName: " + ;
            ( Alias( n ) )->( rddName() ) + CRLF

         cErrorLog += "     =======================================================" + CRLF
         cErrorLog += "     RecNo    RecCount    BOF   EOF" + CRLF

         cErrorLog += "   " + Transform( ( Alias( n ) )->( RecNo() ), "9999999" ) + ;
            "     " + Transform( ( Alias( n ) )->( RecCount() ), "9999999" ) + ;
            "    " + cValToChar( ( Alias( n ) )->( Bof() ) ) + ;
            "   " + cValToChar( ( Alias( n ) )->( Eof() ) ) + Transform( ( Alias( n ) )->( ordKeyCount() ), "9999999" )  + CRLF + CRLF

         IF ( Alias( n ) )->( rddName() ) != "ARRAYRDD"

            cErrorLog += "     Indexes in use " + Space( 23 ) + "TagName" + CRLF + CRLF

            FOR j = 1 TO 25
               IF ! Empty( ( Alias( n ) )->( IndexKey( j ) ) )
                  cErrorLog += Space( 8 ) + ;
                     If( ( Alias( n ) )->( IndexOrd() ) == j, "=> ", "   " ) + ;
                     PadR( ( Alias( n ) )->( IndexKey( j ) ), 35 ) + ;
                     ( Alias( n ) )->( ordName( j ) ) + ;
                     CRLF
               ENDIF
            NEXT

            cErrorLog += CRLF + "     Alias Name : "+ Alias(n) + CRLF + CRLF
            cErrorLog += CRLF + "     Filters set : " + (alias(n))->(dbfilter())+ CRLF + CRLF
            cErrorLog += CRLF + "     Relations in use" + CRLF + CRLF

            FOR j = 1 TO 8

               IF .NOT. Empty( ( nTarget := ( Alias( n ) )->( dbRSelect( j ) ) ) )

                  cErrorLog += Space( 3 ) + Str( j ) + ": " + ;
                     "TO " + ( Alias( n ) )->( dbRelation( j ) ) + ;
                     " INTO " + Alias( nTarget ) + CRLF

               ENDIF

            NEXT

         ENDIF

      ENDIF

   NEXT

   // FW_memoEdit(cErrorlog)
   // FW_MemoEdit( cErrorlog, "Geopende Databases", 10, 60, 60, 150 ) // Holandes

   // // Lista de bancos de dados abertos
   // FW_MemoEdit( cErrorlog, "Lista de Bancos de Dados Abertos", 00, 50, 45, 120 ) // Portugues

   IF FILE( "MARC.TXT" )
      FERASE( "MARC.TXT" )
   ENDIF

   // TEXT
   MemoWrit( "MARC.TXT", cErrorlog )

   cText := MEMOREAD( ".\MARC.TXT" )

   // LOGO
   nRow  :=  10
   nCol  := 600

   // Idea orginal by Marc Venken - Belgium
   PRINT oPrn NAME "ERRSYSW: OPEN DATABASES IN THE SYSTEM" PREVIEW MODAL

      DEFINE FONT oFont NAME "COURIER NEW" SIZE 0, -10 OF oPrn

      oPrn:SetPage(9)   //-> A4 //9
      oPrn:SetPortrait()

      WHILE .NOT. EMPTY( cText )

         SYSREFRESH()

         PAGE

            IF FILE( "LOGO.PNG" )

               @ nRow, nCol PRINT TO oPrn IMAGE "LOGO.PNG" SIZE 600, 600 LASTROW nRow

            ENDIF

            @ 1, 1 PRINT TO oPrn TEXT @cText SIZE 7, 10 INCHES FONT oFont

         ENDPAGE

      ENDDO

      IF lPdfImp

        oPrn:lMeta = .F.  // .T. -> Defecto  - .F. Genera el PDF.

      ENDIF

   ENDPRINT

   IF lPdfImp

      FWSavePreviewToPDF( oPrn, "MARC.pdf", .F. )

   ENDIF

   RELEASE FONT oFont

RETURN NIL // Marc Venken

// FIN / END - kapiabafwh@gmail.com
 


Marc, thank you.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7613
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: WorkSpaceList()

Postby Jimmy » Thu Jun 01, 2023 2:44 pm

hi,

thx all for Answer
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1699
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 64 guests