I must show 2 browser with different indexes
the first UNIQUE ( index by < names > ) the second ( Index by < names + articel > )
is that possible ?
The problem :
before I used a customer.dbf and a article.dbf with relation on customer-name.
It works fine but It can be, that the custumer is not included in custumer.dbf anymore after some years
to make it possible to select the customer and control the articles.
I have to use the included names from the articel.dbf using UNIQUE for the customer-selection
to show the related articles in browser 2.
I noticed only the 2. index is used
Browser 1 and browser 2 are using the same index
My test to split the customer.dbf in 2 browser.
USE customer NEW SHARED ALIAS CUSTOMER VIA 'DBFCDX'
ORDCREATE( ,"CUST1", "UPPER(LAST)", ;
{|| UPPER(LAST) } , .T. ) // .T. = UNIQUE IGNORED !!!
ORDCREATE( ,"CUST2", "UPPER(LAST)", ;
{|| UPPER(LAST) } , .F. )
My test
Code: Select all
#include 'fivewin.ch'
#include 'ord.ch'
#include 'xbrowse.ch'
REQUEST DBFCDX
//--------------------------------------
FUNCTION MAIN()
local oDlg, oBrw1, oBrw2, oFont1, oFont2, oBtn1
DEFINE FONT oFont1 NAME "TAHOMA" SIZE 0,-14
DEFINE FONT oFont2 NAME "TAHOMA" SIZE 0,-18
SETBALLOON( .T. ) // Balloon shape required for tooltips
DEFINE DIALOG oDlg SIZE 590, 540 PIXEL COLOR 255 ;
TITLE "Testing UNIQUE in XBrowse" ;
FONT oFont1
// ------
USE customer NEW SHARED ALIAS CUSTOMER VIA 'DBFCDX'
ORDCREATE( ,"CUST1", "UPPER(LAST)", ;
{|| UPPER(LAST) } , .T. ) // .T. = UNIQUE
ORDCREATE( ,"CUST2", "UPPER(LAST)", ;
{|| UPPER(LAST) } , .F. )
DBSELECTAREA( "CUSTOMER" )
("CUSTOMER")->(DBSETORDER( "CUST1" ))
("CUSTOMER")->( DBGOTOP() )
@ 15, 15 XBROWSE oBrw1 ;
COLUMNS 'Last', 'Age', 'Value' ;
OF oDlg ;
SIZE 220, 112 PIXEL ;
COLSIZES 195, NIL, 95 ;
PICTURES nil, '999.99 %', '999999.99' ;
ALIAS 'CUSTOMER' ;
CELL LINES AUTOCOLS AUTOSORT
oBrw1:bClrStd := { || If( oBrw1:KeyNo() % 2 == 0, ;
{ If( ( oBrw1:cAlias )->( Deleted() ), 255, 0 ), 15329747 }, ;
{ If( ( oBrw1:cAlias )->( Deleted() ), 255, 0 ), 16053482 } ) }
oBrw1:bClrSel := ;
oBrw1:bClrSelFocus := { || { If( ( oBrw1:cAlias )->( Deleted() ), 255, 0 ), 14935039 } }
oBrw1:nRecSelColor := 14201187
WITH OBJECT oBrw1
:CreateFromCode()
END
// ----------------- BROWSER 2
DBSELECTAREA( "CUSTOMER" )
("CUSTOMER")->(DBSETORDER( "CUST2" ))
("CUSTOMER")->( DBGOTOP() )
@ 140, 15 XBROWSE oBrw2 ;
COLUMNS 'Last', 'Age', 'Value' ;
OF oDlg ;
SIZE 220, 112 PIXEL ;
COLSIZES 195, NIL, 95 ;
PICTURES nil, '999.99 %', '999999.99' ;
ALIAS 'CUSTOMER' ;
CELL LINES AUTOCOLS AUTOSORT
oBrw2:bClrStd := { || If( oBrw2:KeyNo() % 2 == 0, ;
{ If( ( oBrw2:cAlias )->( Deleted() ), 255, 0 ), 15329747 }, ;
{ If( ( oBrw2:cAlias )->( Deleted() ), 255, 0 ), 16053482 } ) }
oBrw2:bClrSel := ;
oBrw2:bClrSelFocus := { || { If( ( oBrw2:cAlias )->( Deleted() ), 255, 0 ), 14935039 } }
oBrw2:nRecSelColor := 14201187
WITH OBJECT oBrw2
:CreateFromCode()
END
// ------------
@ 240, 250 BTNBMP oBtn1 OF oDlg ;
SIZE 37, 20 PIXEL 2007 ;
BORDER CENTER ROUND ;
PROMPT "&Exit" ;
ACTION oDlg:End()
oBtn1:bClrGrad := { | lMouseOver | If( ! lMouseOver,;
{ { 0.5, 14342911, 16119295 }, { 0.5, 16119295, 14342911 } }, ;
{ { 0.5, 14277043, 16053482 }, { 0.5, 16053482, 14277043 } } ) }
oBtn1:cToolTip = { "Exit" + CRLF + "test","EXIT", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 0, )
DLG_BRUSH(oDlg, 2, 16182746, "Wall.bmp")
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont1
RELEASE FONT oFont2
RETURN NIL
// --------------------------------
STATIC FUNCTION DLG_BRUSH(oDlg, nStyle, nColor, cBmp, cImage)
LOCAL oBrush, oImage
LOCAL aRect := GETCLIENTRECT( oDlg:hWnd )
IF nStyle = 1
DEFINE BRUSH oBrush COLOR nColor
ENDIF
IF nStyle = 2
DEFINE BRUSH oBrush FILENAME cBmp
ENDIF
IF nStyle = 3
DEFINE IMAGE oImage FILE cImage
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, aRect[4], aRect[3], .T. ) )
oImage:End()
ENDIF
oDlg:SetBrush( oBrush )
RELEASE BRUSH oBrush
RETURN NIL
best regards
Uwe