To Nages searching on xbrowse

To Nages searching on xbrowse

Postby Silvio.Falconi » Fri Aug 17, 2018 4:03 pm

Dear Rao,

I set the xbrowse as your sample :

Image


your test
Code: Select all  Expand view
#include "fivewin.ch"

function colsasrows2()

   local oWnd, oBrw, oFont, aCols
   local nLine    := 0

   USE CUSTOMER ALIAS CUST

 //  xbrowse()

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE WINDOW oWnd
   oWnd:SetFont( oFont )

   aCols := { ;
      { { || If( nLine == 0, STR(CUST->ID,4), "" ) }, "ID" }, ;
      { { || If( nLine == 0, CUST->FIRST+" "+CUST->LAST, If( nLine == 1,  CUST->ZIP, CUST->ZIP ) ) }, "CustName" }, ;
      { { || If( nLine == 0, CUST->STREET, If( nLine == 1, CUST->CITY, CUST->ZIP ) ) }, "Address" }, ;
      { { || If( nLine == 0, DTOC(CUST->HIREDATE), If( nLine == 1, Str( CUST->AGE, 2 ), TRANSFORM( CUST->SALARY,"9,999,999.99") ) ) }, "Details" } }



   @ 0,0 XBROWSE oBrw OF oWnd DATASOURCE "CUST" ;
      COLUMNS aCols ;
      CELL LINES NOBORDER

   // Navigation blocks
   oBrw:bGoTop    := { || nLine := 0, ( oBrw:cAlias )->( DBGOTOP()    ) }
   oBrw:bGoBottom := { || nLine := 2, ( oBrw:cAlias )->( DBGOBOTTOM() ) }
   oBrw:bKeyCount := { || ( oBrw:cAlias )->( OrdKeyCount() ) * 3 }
   oBrw:bKeyNo    := { || ( ( oBrw:cAlias )->( OrdKeyNo() - 1 ) * 3 ) + 1 + nLine  }
   oBrw:bSkip     := { |nSkip| ( oBrw:cAlias )->( MySkipper( nSkip, @nLine ) ) }
   oBrw:bKeyNo := { |n| If( n != nil, ( n--, ( oBrw:cAlias )->( OrdKeyGoTo( Int( n / 3 ) + 1 ) ), nLine := n % 3 ), nil ), ;
                        ( ( oBrw:cAlias )->( OrdKeyNo() - 1 ) * 3 ) + 1 + nLine }
   oBrw:bBookMark := { |n| If( n != nil, ( n--, ( oBrw:cAlias )->( DbGoTo( Int( n / 3 ) + 1 ) ), nLine := n % 3 ), nil ), ;
                        ( ( oBrw:cAlias )->( RecNo() - 1 ) * 3 ) + 1 + nLine }


   WITH OBJECT oBrw
      :aCols[ 1 ]:nDataStrAlign := AL_RIGHT


      :aCols[ 2 ]:bLeftText   := { || If( nLine == 0, "", If( nLine == 1, "Phone1", "Phone2:" ) ) }
      :aCols[ 2 ]:bStrImage     :=  { || If( nLine == 0, "", If( nLine == 1, "phone.bmp", "phone2.bmp" ) ) }
      :aCols[ 2 ]:nDataBmpAlign := AL_RIGHT

      :aCols[ 3 ]:bStrImage     :=  { || If( nLine == 0, "address.bmp", If( nLine == 1, "city.bmp", "note.bmp" ) ) }
      :aCols[ 3 ]:nDataBmpAlign := AL_RIGHT
      :aCols[ 3 ]:nWidth      := 340
      :aCols[ 3 ]:bLeftText   := { || If( nLine == 0, "Address:", If( nLine == 1, "City:", "Cap:" ) ) }

      :aCols[ 4 ]:nWidth      := 140
      :aCols[ 4 ]:nDataStrAlign := AL_RIGHT
      :aCols[ 4 ]:bLeftText   := { || If( nLine == 0, "Date:", If( nLine == 1, "Age:", "Sal:" ) ) }



      :bClrStd    := { || { CLR_BLACK, If( nLine == 0, CLR_HGRAY, CLR_WHITE ) } }
      //
      :CreateFromCode()
   END
   oWnd:oClient   := oBrw

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE FONT oFont

return nil

static function MySkipper( nSkip, nLine )

   local nSkipped := 0

   DEFAULT nSkip := 1

   if nSkip == 0
      return 0
   endif
   if nSkip > 0
      do while nSkipped < nSkip
         if nLine < 2
            nLine++
            nSkipped++
         else
            DBSKIP( 1 )
            if Eof()
               DBGOBOTTOM()
               EXIT
            endif
            nLine := 0
            nSkipped++
         endif
      enddo
   else
      do while nSkipped > nSkip
         if nLine > 0
            nLine--
            nSkipped--
         else
            DBSKIP( -1 )
            if BOF()
               EXIT
            endif
            nLine    := 2
            nSkipped--
         endif
      enddo
   endif

return nSkipped
 


Now I have problem to search first,Last and City on Incremental and I not Know how make it

My customer not want seekbar , he wish have 3 gets at bottom of xbrowse to search his clients

Can you help me please
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6783
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages searching on xbrowse

Postby Silvio.Falconi » Mon Aug 27, 2018 4:04 pm

any solution please
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6783
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages searching on xbrowse

Postby nageswaragunupudi » Mon Aug 27, 2018 5:17 pm

1) Can you provide link to my original sample? I would have never used bStrImage here.

2) Gets and Incremental seeks are mutually exclusive. If you want to use Get, then let the user enter the value in the Get first. After her enters you SEEK the vaue and then set oBrw:BoookMark := RECNO()
Regards

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

Re: To Nages searching on xbrowse

Postby Silvio.Falconi » Mon Aug 27, 2018 7:23 pm

1 .I not remember where I save this sample
perhaps
viewtopic.php?f=3&t=35687&p=212509#p212509
and
viewtopic.php?f=3&t=35904&p=214011#p213878

I wish create something as
Image


2. I sent you my test

My customer not want seekbar to search on archive and I not Know How resolve it
my customer ask me to put 3 gets at bottom to search First,Last and city of his customers
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6783
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages searching on xbrowse

Postby James Bott » Tue Sep 04, 2018 12:40 am

Silvio,

>my customer ask me to put 3 gets at bottom to search First, Last and city of his customers

You have to be careful about letting your customer design interfaces. You are the database and interface expert.

You can give them what they think they want and when it doesn't work, then they will blame you. I've been down that road.

The way to do an incremental search on three fields is to create an index on

upper( rtrim(last) + ", " + rtrim(first) +", "+rtrim(city) )

Then do an incremental search on that all in one field (on a searchbar). The user will have to remember to include the commas also.

If you do what they want and give them three separate fields, then when they fill them all out, you have to paste them together an then do a SEEK. But if there is a difference anywhere in the string the user typed and the database, the result will be empty. Then what?

With an incremental search, if the result is empty after hitting the last key, then they can back up one key and browse the list of matches.

Note that I put the last name first, THEN the first name. This is because usually there will be more people with the same first name than with the same last name. Thus putting the last name first gets you a result with less keystrokes.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: To Nages searching on xbrowse

Postby James Bott » Tue Sep 04, 2018 1:14 am

Another good customer search field is phone number.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: To Nages searching on xbrowse

Postby Enrico Maria Giordano » Tue Sep 04, 2018 8:49 am

James Bott wrote:You have to be careful about letting your customer design interfaces. You are the database and interface expert.

You can give them what they think they want and when it doesn't work, then they will blame you. I've been down that road.


Words of wisdom! Unfortunately, it's a lost fight against customers… :-(

James Bott wrote:The way to do an incremental search on three fields is to create an index on

upper( rtrim(last) + ", " + rtrim(first) +", "+rtrim(city) )


You can't create an index on a variable length key. You have to PADR() all the keys to a sufficient size.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8327
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: To Nages searching on xbrowse

Postby Silvio.Falconi » Tue Sep 04, 2018 10:16 am

We tried in every way to convince our customer to enter the SeekBar
but our client wants to search the archive through the 3 gets because he had it in another program created in vb.

I can not argue with our customer for this change, so I ask all fivewin friends to help me find solutions
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6783
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages searching on xbrowse

Postby James Bott » Tue Sep 04, 2018 5:48 pm

Enrico,

>Words of wisdom! Unfortunately, it's a lost fight against customers.

Yes, it can be touchy, but if you can convince them why, then usually they will go with it. That is why I gave Silvio the reasoning. You could even give them a demo of each system to prove your point.

>You can't create an index on a variable length key. You have to PADR() all the keys to a sufficient size.

Yes, of course. I stand corrected, you do need to pad it. [I only had three hours of sleep the previous night].

padr( upper( rtrim(last) + ", " + rtrim(first) +", "+rtrim(city) ), [nLength] )

Where nLength is the sum of the lengths of all three fields--not a variable but the length as a number.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: To Nages searching on xbrowse

Postby James Bott » Tue Sep 04, 2018 5:52 pm

Silvio,

>I can not argue with our customer for this change, so I ask all fivewin friends to help me find solutions.

I did not mean to argue, but rather to explain how it can be done better and the problems with doing the way they want. As I mentioned above a small demo of each system would show them exactly the problems.

>but our client wants to search the archive through the 3 gets because he had it in another program created in vb.


The fact that they had a system like that is important information. Unfortunately we do not know exactly how their old system worked.

Did they just type in data for one field, then search? Or, did they have to type in all three fields, then search? Could they be partial data? Was the searching incremental or only when a "Search" button was pressed? Did it show a scrolling list of records before and after the search result record, or just the matching record? What if there was no matching record because of a typo in either the database or the fields? How did they resolve no matching record?

Without that information, you can't give them what they had before.

Also, I would try to find out what they don't like about a search bar. As you know, all searches are not done the same, so maybe it was a poor design that they didn't like. So what you really need to know is what did they like about the 3 field search and what don't they like about a search bar incremental search. You can say you just want to know this so you can improve on your search bars (not that you are trying to force them to use one).

You can start your conversation with your client saying something like you really need to know more about how the search function they want worked so you can be sure to give them what they want. Ask them the questions I gave above.

Let us know what you find out.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: To Nages searching on xbrowse

Postby Silvio.Falconi » Wed Sep 05, 2018 9:14 am

Unfortunately it is not so easy

I work at school as you know and in Italy who already has a job can not invoice my applications.

In Itali asolo who is registered with a professional register can perform two jobs
There is the register of engineers, lawyers, doctors, but in Italy there is still no ALBO of computer scientists

To sell the applications I support myself in a company that then is the one that makes the invoice of my applications and takes responsibility.

The owner of the company that owns the invoice is a former VB programmer and decides all the fields and how the screens must be made and the same speaks with the customers.

I think we can find a solution by entering the three get under my xbrowse one for the last name one for the name and one for the city. I hope you have a heart to help me because I really do not know how to do this incremental search on xbrowse.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6783
Joined: Thu Oct 18, 2012 7:17 pm

Re: To Nages searching on xbrowse

Postby James Bott » Wed Sep 05, 2018 3:46 pm

Silvio,

I think you are saying that is your boss you have to make happy, not the customer?

Either way, you cannot implement this without knowing how it is supposed to work. If you try, they you are only building it the way YOU think it should work, and you are very likely to fail. You really need answers to the questions I proposed in my previous message.

Also, are you saying you don't know how to do an incremental search in a browse at all? Or you don't know how to do it with three fields?

For a single field, you just use a GET with an ON CHANGE clause. For each change you do a seek, then redisplay the browse.

When you have more than one GET, then things can get really complicated. They could each work independently, or all three at once.

Even if they are independent, there are still issues that have to be handled. If the user types in the 1st field, then jumps to the second field, what happens to the data in the first field? It gets ignnored? It gets erased? You attempt to match on both fields somehow?

The simplest would be just three independent searches. When you click to a new field, then existing data in the previous field gets erased automatically, the index is changed to the new field, and the search is done on that field. However, I find this not very useful in narrowing down a search. Finding all customers in one city could be thousands. It is not practical to browse thousands of customers looking for the one you want. If there were less than say 50 customers then it might work but still be somewhat tedious.

As you can see there are lots of unanswered questions for which you need answers.

Without answers to those questions you can't proceed. If your boss is the one who wrote the code for the three field searches, then surely he can explain exactly how it works. I would not even try to proceed until I had those answers. Oh, and since your boss wrote the original app, then perhaps he can show you a demo of how it works.

I just re-read the previous posts and it was only you that mentioned incremental searches. There is another question, are the three fields incremental searches, or just fill out the field then press a Search button searches?


If you don't know where you are going, any road will get you there. -Lewis Carroll
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

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