possible xBrowse-refresh with another Dbf ?

possible xBrowse-refresh with another Dbf ?

Postby ukoenig » Fri Aug 07, 2015 3:53 pm

Hello,

is it possible to refresh a xbrowse with another DBF ( same structure ) ?

With this sample I open the month JUNE

Image

I'm starting with a defined month
12 month are possible to display in browser 2
there is a RELATION between browser 1 and 2 ( names )
I would like to change the month in browser 2

Browser 1 ( names )

DBSELECTAREA( "KUNDE" )
( "KUNDE" )->(DBSETORDER( "KUNDE1" ))
( "KUNDE" )->( ORDSETRELATION( cMonat, { || UPPER(NAME1 + NAME) }, "UPPER(NAME1 + NAME)" ) )
( "KUNDE" )->( DBGOTOP() )


Browser 2 ( month with relation on names )

DBSELECTAREA( cMonat )
( cMonat )->(DBSETORDER( cMonat ))
( cMonat )->( DBGOTOP() )


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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: possible xBrowse-refresh with another Dbf ?

Postby James Bott » Fri Aug 07, 2015 4:08 pm

Uwe,

Well, I'm not sure exactly what you are trying to do, but whatever the trigger is for the first browse, use that to set the scope of the second browse.

If that is not what you were looking for, then please explain in more detail.

james
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: possible xBrowse-refresh with another Dbf ?

Postby ukoenig » Fri Aug 07, 2015 4:17 pm

James,

using the < month-button >, I want to replace the data in browser 2
sample : starting with june the JUNE.dbf is shown in browser 2
On button-action like using JULY I want to change the data in browser 2 to JULY

I could zap the first data in browser 2 ( June ) and append from July ?

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: possible xBrowse-refresh with another Dbf ?

Postby James Bott » Fri Aug 07, 2015 4:41 pm

Uwe,

I could zap the first data in browser 2 ( June ) and append from July ?


You should just be using scopes with the entire database. Then all you have to do is change the scope on the second browse and refresh it.

Just index the database on month, then set the scope to that month and refresh the browse.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: possible xBrowse-refresh with another Dbf ?

Postby ukoenig » Fri Aug 07, 2015 5:46 pm

James,

the problem : there are < 12 > Files created on another part, 1 for each month
I cannot make just 1 file and using scope for a month.
I must define different files for the browser 2

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: possible xBrowse-refresh with another Dbf ?

Postby FranciscoA » Fri Aug 07, 2015 7:48 pm

ukoenig wrote:Hello,

is it possible to refresh a xbrowse with another DBF ( same structure ) ?

With this sample I open the month JUNE

Image

I'm starting with a defined month
12 month are possible to display in browser 2
there is a RELATION between browser 1 and 2 ( names )
I would like to change the month in browser 2

Browser 1 ( names )

DBSELECTAREA( "KUNDE" )
( "KUNDE" )->(DBSETORDER( "KUNDE1" ))
( "KUNDE" )->( ORDSETRELATION( cMonat, { || UPPER(NAME1 + NAME) }, "UPPER(NAME1 + NAME)" ) )
( "KUNDE" )->( DBGOTOP() )


Browser 2 ( month with relation on names )

DBSELECTAREA( cMonat )
( cMonat )->(DBSETORDER( cMonat ))
( cMonat )->( DBGOTOP() )


best regards
Uwe :?:


Hi, Uwe.
Try to change the xBrowse alias y refresh the xBrowse.
example:

REDEFINE XBROWSE oBrw ID.... COLUMNS.... ;
ALIAS cAlias

On click button July...
oBrw:cAlias:= "JULY"
oBrw:Refresh()
etc.

I Hope this may helps.

Regards.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: possible xBrowse-refresh with another Dbf ?

Postby James Bott » Fri Aug 07, 2015 7:52 pm

Unless you have millions of records, I can't see any good reason to have a different file for each month. Doesn't that also mean you have to have 12 for each year also? I would think that makes things more complicated that they would be if they were all in the same file.

However, since you do, just close the file for the month in use and open the one for the month desired and refresh the browse. Well, you would have to be using database objects for it to be that simple. Otherwise you might be able to give all the month files the same alias when you open them so the browse still thinks it is using the same file.

James

Update: I see Francisco was writing a response while I was writing mine. And I see he had the same suggestion.
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: possible xBrowse-refresh with another Dbf ?

Postby ukoenig » Fri Aug 07, 2015 8:00 pm

James, Francisco

thank You very much.
records are no problems, because it only can be a maximum of round about 200 records
( writing bills of a month )
One solution I got working. I will test the others to find out the best one to keep.

best regards
Uwe :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: possible xBrowse-refresh with another Dbf ?

Postby ukoenig » Sun Nov 08, 2015 10:09 pm

Hello,

still my old problem using one xbrowse and changing the workarea.
I have to use a EXTRA statistic-file for each month.
Define a new Alias on button-selection doesn't work. Tested oBrw1:cAlias := cUmsName ( new DBF ) as well.
It works only once on startup.
Using BROWSE() it shows the change-result but xBrowse doesn't accept the DBF-change.

Image

Image

REDEFINE XBROWSE oBrw1 ID 110 OF oFld:aDialogs[ 1 ] AUTOSORT FASTEDIT ;
COLUMNS { "NACHNAME", "VORNAME", ;
"KOST_RZH", "KOST_PRI", "KOST_BEI", ;
"KRK", "KRX", ;
"PFK0", "PFX0", "PFK1", "PFX1", "PFK2", "PFX2", "PFK3", "PFX3", ;
"B1X", "PBK", "PBX", "B2X", ;
"PRA", "VPK", "VPX", "PRI", "BERG", "SUMME", "PKT_SUMME" } ;
ALIAS
cUmsName UPDATE

cUmsName to be changed on button-action

maybe something missing ?

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: possible xBrowse-refresh with another Dbf ?

Postby FranciscoA » Mon Nov 09, 2015 3:15 am

Uwe:

I extracted this partial code , from my accounting program. I tried it before post it here , and it works for me. Maybe it will be of some help.
All necessary tables have been open at program startup .
All tables have the same structure.
Regards.

Code: Select all  Expand view
//------------------------------
FUNCTION Transacc()
LOCAL oDlg, oLbx
LOCAL cTitulo:="TRANSACCIONES"
local cDocum := 'CD'   //Por defecto sera comprobantes de diario
local cAlias
local oDoc1,oDoc2,oDoc3,oDoc4,oDoc8, oCol

dbselectarea("comprobd")  //el primer boton es comprobantes de diario
if comprobd->(bof()) .or. comprobd->(eof())
   comprobd->(dbgotop())
endif
cAlias:=Alias()
   
 DEFINE DIALOG oDlg RESOURCE "Grabar2" TITLE cTitulo

  dbselectar(cAlias)

  oLbx := TXBrowse():New( oDlg )
  oLbx:cAlias:=(cAlias)

  oCol = oLbx:AddCol()
  oCol:bStrData = { || DtoC((cAlias)->Fechemis) }
  oCol:nDataStrAlign := 1
  oCol:cHeader = "Fecha"
  oCol:nWidth = 66

  oCol = oLbx:AddCol()
  oCol:bStrData = { || Transform( (cAlias)->NumDoc,"9999999999")  }
  oCol:cHeader = "Documento"
  oCol:nWidth = 70
  oCol:nFootStrAlign := 1

  oCol = oLbx:AddCol()
  oCol:bStrData = { || TRANSFORM((cAlias)->Debe,"@Z 99,999,999,999.99") }
  oCol:nDataStrAlign := 1
  oCol:cHeader = "Debitos"
  oCol:nWidth = 100

  oCol = oLbx:AddCol()
  oCol:bStrData = { || TRANSFORM((cAlias)->Haber, "@Z 99,999,999,999.99") }
  oCol:nDataStrAlign := 1
  oCol:cHeader = "Creditos"
  oCol:nWidth = 100

  oLbx:CreateFromResource(181)
  oLbx:SetRDD()


//Tipo de Documentos
   REDEFINE BTNBMP oDoc1 ID 221 OF oDlg RESOURCE "cdiario"   LEFT 2007  ACTION ( dbSelectArea("comprobd"), cAlias:=Alias(),oLbx:cAlias:=cAlias,oLbx:Refresh(), cDocum := 'CD' )
   REDEFINE BTNBMP oDoc2 ID 222 OF oDlg RESOURCE "RCAJARJ2"  LEFT 2007  ACTION ( dbSelectArea("RecibCaj"), cAlias:=Alias(),oLbx:cAlias:=cAlias,oLbx:Refresh(), cDocum := 'RJ' )
   REDEFINE BTNBMP oDoc3 ID 223 OF oDlg RESOURCE "MINUTAS"   LEFT 2007  ACTION ( dbSelectArea("Minutas"),  cAlias:=Alias(),oLbx:cAlias:=cAlias,oLbx:Refresh(), cDocum := 'MI' )
   REDEFINE BTNBMP oDoc4 ID 224 OF oDlg RESOURCE "CHEQUES"   LEFT 2007  ACTION ( dbSelectArea("cheques"),  cAlias:=Alias(),oLbx:cAlias:=cAlias,oLbx:Refresh(), cDocum := 'CH' )
   REDEFINE BTNBMP oDoc8 ID 228 OF oDlg RESOURCE "SALIR"     LEFT 2007  ACTION ( oDlg:End() )

  ACTIVATE DIALOG oDlg CENTERED  

RETURN NIL
 
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2114
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: possible xBrowse-refresh with another Dbf ?

Postby James Bott » Mon Nov 09, 2015 5:59 am

Uwe,

Did you also open new indexes with the new database? It looks like there are no indexes open with error you are getting.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: possible xBrowse-refresh with another Dbf ?

Postby nageswaragunupudi » Mon Nov 09, 2015 8:41 am

XBrowse is designed to switch oBrw:cAlias at runtime any number of times, provided

1) All DBFs should have the same structure and indexes in respect of the fields being browsed. (Fields and indexes not used by browse can be different)

2) Use recommended command syntax to create xbrowse including COLUMNS clause

3) Never refer to the alias directly in your code. If necessary you should use (oBrw:cAlias)

4) Avoid using :AddCol() :InsCol() and deprecated methods like bstrdata
Regards

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

Re: possible xBrowse-refresh with another Dbf ?

Postby ukoenig » Mon Nov 09, 2015 9:55 am

Thank You very much for the infos.

My prg-structure looks nearly the same like Francisco's sample.
The difference : the user opens a DBF ( month-selection 1 - 12 ) I don't know before.
That will switch to a existing DBF or create a new one if not exists.
The created index is a UNIQUE-index and the structure of the month-dbf 1-12 is the same.
I will create a little test with the used prg-structure.
In case it doesn't work, I could move the month-selection to a extra dialog at startup.

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: possible xBrowse-refresh with another Dbf ?

Postby ukoenig » Mon Nov 09, 2015 12:21 pm

I got it working like

DBSELECTAREA(cUmsName)
REDEFINE XBROWSE oBrw1 ID 110 OF oFld:aDialogs[ 1 ] AUTOSORT FASTEDIT ;
COLUMNS { "NACHNAME", "VORNAME", ;
"KOST_RZH", "KOST_PRI", "KOST_BEI", ;
"KRK", "KRX", ;
"PFK0", "PFX0", "PFK1", "PFX1", "PFK2", "PFX2", "PFK3", "PFX3", ;
"B1X", "PBK", "PBX", "B2X", ;
"PRA", "VPK", "VPX", "PRI", "BERG", "SUMME", "PKT_SUMME" } ;
ALIAS cUmsName UPDATE


and changing from Button :
( inside function STAT_OPEN1 the old DBF is closed and a new workarea is defined )

oBrw1:cAlias := cUmsName // tested before and returns a error
oBrw1:cAlias := Alias() // workes with NO error

@ 5, 160 BTNBMP oBBtn[1] OF oBar ;
SIZE 80, 30 PIXEL ;
BORDER ;
PROMPT " &Jan." ;
FILENAME c_Pfad1 + "Kalender.Bmp" ;
ACTION ( STAT_OPEN1("RECH1"), nPos := 1, ;
oBrw1:cAlias := Alias(), ;
oBrw1:Refresh(), ;

cTitel := "Januar", oTitel1:Refresh() ) LEFT

best regards
Uwe :D
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 30 guests