FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to show multiple xBrowse with different file-sections
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
How to show multiple xBrowse with different file-sections
Posted: Tue Oct 06, 2015 12:23 PM
Hello,

for a backup-system I'm using a DBF with the files to be selected
there are 4 groups
1. group with month 1- 12, record 1-12
2. group with month 1- 12, record 13 - 24
3. group with month 1- 12, record 25 - 36
4. group with extra files, record 37 - 40

what is the best solution to define the 4 browsers ( if possible ) ?



Another solution ( maybe better ), using one browser and filtering the 4 sections on button-action.

ACTION ( ("BACKUP")->( DBSETFILTER( NIL ) ), ;
("BACKUP")->( DBSETFILTER( {|| ("BACKUP")->(RECNO()) > 24 .and. ("BACKUP")->(RECNO()) < 37 } ) ), ;
("BACKUP")->(DBGOTOP()), oBrw1:Refresh() ) ;



best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: How to show multiple xBrowse with different file-sections
Posted: Tue Oct 06, 2015 02:13 PM

Hola,

use folders or tabs will be clearer

regards

Marcelo

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: How to show multiple xBrowse with different file-sections
Posted: Tue Oct 06, 2015 02:37 PM
For a different reasons I open the same file in multiple areas.

Code (fw): Select all Collapse
local cAlias1, cAlias2, cAlias3, cAlias4

OpenMyFile("MyDbf", @cAlias1,.f.,::"MyDbfDir")
OpenMyFile("MyDbf", @cAlias2,.f.,::"MyDbfDir")
OpenMyFile("MyDbf", @cAlias3,.f.,::"MyDbfDir")
OpenMyFile("MyDbf", @cAlias4,.f.,::"MyDbfDir")

Now I have 4 individual views of the same dbf. Set scopes or filters for each area.
Then later close all 4
dbselectalias( cAlias1 )
use
dbselectalias( cAlias2 )
use
dbselectalias( cAlias3 )
use
dbselectalias( cAlias4 )
use


Function OpenMyFile(pcFile, pcAlias, plExclusive, pcPath, pcVia )
   local nPos := 0
   local cAlias := ""
   local nCount := 0
   local cTest
   local lReturn := .f.
   if pcPath == nil
      pcPath := '.\'
   endif

   nPos := at(".", pcFile)

   if nPos > 0
      cAlias := left(pcFile, nPos - 1)
      cAlias := left(pcFile, max(len(cAlias), 8))
   else
      cAlias := pcFile
   endif

   cTest := cAlias+ltrim(str(nCount, 3))
   while select(cTest) > 0
      nCount++
      cTest := cAlias + ltrim(str(nCount, 3))
   enddo

   pcAlias := cTest

   lReturn := netuse( pcPath+pcFile, plExclusive,5,pcVia, pcAlias )

return( lReturn )
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: How to show multiple xBrowse with different file-sections
Posted: Tue Oct 06, 2015 02:42 PM

For some reason the code below was altered ( \ was removed) when pasted into the previous reply.

if pcPath == nil
pcPath := '.\'
endif

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: How to show multiple xBrowse with different file-sections
Posted: Tue Oct 06, 2015 03:09 PM

Similar to how Gale does it, you can open four database objects, each with it's own scope. It only takes two lines of code for each.

oDB1:= TDatabase():new(,cFile)
oDB1:setScope(...)
...

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: How to show multiple xBrowse with different file-sections
Posted: Tue Oct 06, 2015 10:03 PM

My bad. I am so used to having a database class for each DBF that I showed code more like what I would use. Actually, without a class for the DBF you would have to add the Use() method:

oDB1:= TDatabase():new(,cFile)
oDB1:use()
oDB1:setScope(...)
oDB2:=...

This assumes you are using DBFCDX with auto-opening indexes, otherwise you would have to open the indexes too.

Of course it would be better to create your own class for the database, then you could do:

oDB1:= TWhatever():new()
oDB1:setScope(...)

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: How to show multiple xBrowse with different file-sections
Posted: Wed Oct 07, 2015 05:12 PM
Thank You very much for the infos.

very useful for me as a solution I still need on another section

restoring backups, I created a solution, selecting the sections from buttons
I can switch any old backup to a working file and reverse.
Used backups are visible with red symbols.
Existing backups are shown in column 4



best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion