How to create this xbrowse-filter ?

How to create this xbrowse-filter ?

Postby ukoenig » Fri May 22, 2015 3:43 pm

Hello,

I have a question about creating a xBrowse-filter

There are 2 browser
1. Customer
2. a list of accomplishments of a month for each customer ( browser 1 ) shown in browser 2
the same index is used for browser 1 and 2

Upper ( surname + forename )

because surname can be the same and forename is different
what is the best solution, to filter browser 2 ?

2. for better reading, is it possible to hide 0 - values ?
maybe better to convert values to strings and using a array for browser 2 ?

the screenshot shows just the basics and there is still a lot to do.

Image

best regards
Uwe :?:
Last edited by ukoenig on Fri May 22, 2015 3:57 pm, edited 3 times in total.
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: How to create this xbrowse-filter ?

Postby Rick Lipkin » Fri May 22, 2015 3:54 pm

Uwe

Don't know if this will help you but I use a 'trick' with an Ado (sql ) filter by extracting the value of a Get by keystroke using the :GetText() method and setting the filter to that alltrim string .. it basically immitates an incremental search and refreshed xBrowse with the filter results as I type in each keystroke.

If you are using .dbf you might try Set Order to instead of the :Filter Ado method.

Rick Lipkin

Code: Select all  Expand view

//-------------
Static Func  _Isearch( oSearch1, cSearch1, oId1, cId1, oLbx, oRsCust, cLname, oLname  )

cSearch1 := Alltrim( oSearch1:GetText() )
cLName   := substr(cSearch1+space(50),1,50)
oLname:ReFresh()
cId1     := alltrim( oId1:GetText() )

If Empty( cSearch1 ) .and. Empty( cId1 )

   cLname := space(50)
   oLname:ReFresh()

   oRsCust:Filter := ""
   oRsCust:Filter := "[Last Name] = 'bogus'"
   oLbx:ReFresh()
   Return(.T.)
Endif


Do Case
Case (Empty( cSearch1 ) .and. Empty( cId1 ))
     oRsCust:Filter := "[Last Name] = 'bogus'"

Case !empty( cSearch1 ) .and. Empty( cId1 )
     oRsCust:Filter := "[Last Name] like '"+cSearch1+"%'"

Case (!empty( cSearch1 ) .and. !Empty( cId1 ))
     oRsCust:Filter := "[Last Name] like '"+cSearch1+"%' and [Customer Id] like '"+cId1+"%'"

Case empty( cSearch1 ) .and. !Empty( cId1 )
     oRsCust:Filter := "[Customer Id] like '"+cId1+"%'"

OtherWise
     oRsCust:Filter := "[Last Name] = 'bogus'"
End Case

oLbx:ReFresh()

Return(.t.)
 

Image
User avatar
Rick Lipkin
 
Posts: 2662
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: How to create this xbrowse-filter ?

Postby ukoenig » Fri May 22, 2015 4:17 pm

Rick,

thank You very much.
I will test it, if it works for me.

Hiding the 0 - values, to clean the browser 2 is easy

1. day of 31

oCol:bStrData := { || IIF( (cMonat)->T1 = 0, " ", (cMonat)->T1 ) }

a working filter selecting a customer in browser 1

Filter called on change in browser 1

WITH OBJECT oBrw1
:lIncrFilter := .t.
:lSeekWild := .t.
:bChange := { || FILTER1(cMonat, oFld) }
END


FUNCTION FILTER1(cMonat, oFld)

// fiels from DBF 1
cNName := ("KUNDE")->NAME1
cVName := ("KUNDE")->NAME

// change to dBF 2
DBSELECTAREA( cMonat )
(cMonat)->( DBSETFILTER( NIL ) )
SET FILTER TO (cMonat)->KUNDE = cNName .and. (cMonat)->NAME1 = cVName
DBGOTOP()

// move to browser 2
oBrw2:SetFocus()
oBrw2:Refresh()

// reading fields from browser 2, to refresh folderpage 1
V_GET(nPage, cMonat)
oFld:aDialogs[ nPage ]:Update()

RETURN NIL


Image

best regards
Uwe :)
Last edited by ukoenig on Sat May 23, 2015 6:14 pm, edited 1 time in total.
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: How to create this xbrowse-filter ?

Postby nageswaragunupudi » Sat May 23, 2015 2:54 am

1) To show blanks instead of Zeros

Recommended way is to set
oBrw:lDisplayZeros := .t.
( To the extent possible, we may not directly use bStrData)

2) Master Child Browses:

I assume you are using DBFCDX.

The preferred way is to SET SCOPED RELATION.


I understand you created an index tag on Upper( KUNDE + NAME1 ) on ( cMonat ) DBF.
Let us assume
(1) field lengths of NAME1 and NAME OF KUNDE are the same as KUNDE and NAME1 of ( cMonat )

If so proceed like this:

( cMontat )->( OrdSetFocus( <tagnameof the above index expression> )
SELECT KUNDE
SET RELATION TO UPPER( NAME1 + NAME ) INTO ( cMontat ) SCOPED
[or]
KUNDE->( OrdSetRelation( cMontat, { || UPPER(NAME1+NAME) }, "UPPER(NAME1+NAME)" ) )
KUNDE->( DBGOTOP() )

Now create all browses.
In the first browse:
oBrw1:bChange := { || oBrw2:Refresh(), V_GET(nPage,cMontat), oFld:aDialogs[nPage]:Update() }
Regards

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

Re: How to create this xbrowse-filter ?

Postby ukoenig » Sat May 23, 2015 11:13 am

Mr. Rao,

thank You very much for the infos.
Using RELATIONS instead of a filter is working fine.
I tested using oBrw2:lDisplayZeros := .T. // hide 0
but couldn't see any result
oCol:bStrData := { || IIF( (cMonat)->T1 = 0, " ", (cMonat)->T1 ) }
is working fine

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: How to create this xbrowse-filter ?

Postby nageswaragunupudi » Sat May 23, 2015 11:30 am

Sorry
oBrw:lDisplayZeros := .f. // not .t.

and pls remove bStrdata
Regards

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

Re: How to create this xbrowse-filter ?

Postby ukoenig » Sat May 23, 2015 6:16 pm

Everything is working fine now.
The 1. folderpage is finished with all needed date-calculations.
Thank You for the help

Image

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 46 guests