Complex Search on dbf from an array

Complex Search on dbf from an array

Postby Silvio.Falconi » Wed Feb 13, 2019 12:38 pm

if I have an array with 16 fields ( for a sample 30 records)

and I wish see if I have allready the same record on a dbf

and if found assign on array a check if there is allready a record into dbf

How I must make ?

sample :

I create a price list for the June ( aData array)

Image

I wish Know if the user allready insert each record on tariffe.dbf database

How I must make

I wish check if the fields tipo,idelemento,servizio,settori,giorni,mese are the same
as column 2,3,7,8,9 and 10,

I could index the tariffe.dbf on tipo+idelemento

I must use set filter?
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: 6784
Joined: Thu Oct 18, 2012 7:17 pm

Re: Complex Search on dbf from an array

Postby ukoenig » Wed Feb 13, 2019 3:08 pm

Silvio,

selected customer in DBF2 checked if customer exist in DBF1
( can be a array or fields, from gets ... )

Image

No :Setfilter() :!:

to be filtered
cName := oCust2:Last + oCust2:First

filterd in DBF1 with 450 records
oCust1:ORDSCOPE( 0, NIL ) // reset
oCust1:ORDSCOPE( 1, NIL )

oCust1:ORDSCOPE(0, cName ) // filter
oCust1:ORDSCOPE(1, cName )
oCust1:DBGOTOP()


regards
Uwe :D
Last edited by ukoenig on Wed Feb 13, 2019 8:53 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: Complex Search on dbf from an array

Postby Silvio.Falconi » Wed Feb 13, 2019 3:39 pm

But i have more fields to check
On sql there is the query and on dbf?
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: 6784
Joined: Thu Oct 18, 2012 7:17 pm

Re: Complex Search on dbf from an array

Postby ukoenig » Wed Feb 13, 2019 3:47 pm

Just define a string with any condition to be filtered

if I have an array with 16 fields ( for a sample 30 records)
and I wish see if I have allready the same record on a dbf


cName := oCust2:Last + oCust2:First + :?: + :?:

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: Complex Search on dbf from an array

Postby Silvio.Falconi » Wed Feb 13, 2019 9:02 pm

But i have a hard problem..
The procedure must found a price on dbf having only :
1.Datein and dateout to determine the mounth
2. Number of days
3. Type of produc
4. Code of the product
5. Letter of sector
And the dbf can be much big
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: 6784
Joined: Thu Oct 18, 2012 7:17 pm

Re: Complex Search on dbf from an array

Postby ukoenig » Wed Feb 13, 2019 10:42 pm

Silvio,

I think it will be no problem to replace
Customer and custom2 with 2 other files
and different fields for a new test
You just have to define a main-index where the filter belongs to
( I thinks it is product :?:
Check it out and have a look at test No. 8
of the new download ( have a look at the new image ).

1.Datein and dateout to determine the mounth
2. Number of days
3. Type of produc
4. Code of the product
5. Letter of sector


Just copy TDATAB7.prg to TDATAB8.prg ( empty test )
There replace FUNCTION DATABASE7() with FUNCTION DATABASE8()
and You will have a new test
don't make changes to the original test in case You need some informations.
FUNCTION DATABASE8() is the last empty test. Maybe we still need some more.

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: Complex Search on dbf from an array

Postby Silvio.Falconi » Mon Feb 18, 2019 4:55 pm

I resolved with a easy setfilter

I had difficulty finding the way how to pass the values contained in the tips

Local cFilter := "trim(Tipo) == '" + cTipo +;
"' .and. alltrim(str(giorni))== '" + alltrim(str(nGiorni)) +;
"' .and. idelemento== '"+cidelemento+;
"' .and. settore== '" +cSettore+;
"' .and. alltrim(idlistino)== '" +clistino+"'"

oTariffePrezzi:= TTariffe():new()
oTariffePrezzi:setFilter( cFilter)
oTariffePrezzi:gotop()

nPrezzo:= oTariffePrezzi:totale
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: 6784
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 16 guests