Subject |
Re: lookupsql and Combobox ; where is the missing link |
From |
Dirk <dtweet@outlook.be> |
Date |
Sat, 30 May 2020 09:47:07 +0200 |
Newsgroups |
dbase.getting-started |
Op 30/05/2020 om 8:15 schreef Akshat Kapoor:
> On 30.05.2020 01:56, Dirk wrote:
>> Hello,
>>
>> i changes some *dbf files, using lookupsql
>>
>> as far is all ok, append ad edit all good
>>
>> but im struggling on filter in a form by country
>>
>>
>> by datalink i haven the dat in the combobox
>>
>> when i do the following
>> a=this.parent.rowset.fields["country"].lookupRowset.fields[1].value
>>
>> i get the value a = B of Belgium
>>
>> changing the field to 2 i get Belgium
>>
>>
>> now when i try form.rowset.filter=[country=']+"A"+[']
>>
>> i get filtered by Austria
>>
>> when i try to use the varaible a i get a warning
>>
>> of course when i change teh value of the country, whatever belgium or
>> germany ... i get of course the the value of variable A
>>
>> my question is when i make a choice of a country in the combobox,
>> how it's filtering by chosen country
>
>
> Good Mornign Dirk,
> I would request for a table structure and sql's you are using. It would
> give us a better understanding.
>
> this.parent.rowset.fields["country"].lookupRowset.fields[1].value gives
> us no idea what is the data type and expected values.
>
> With SQL and lookupsql definations we may even be able to suggest changes.
>
> Regards
> Akshat
Good day Akshat,
the main table = stammdat key index idnummer and further on index on
name, postcode, city
the lookup table = country with jey index landcode and sec index land
this.VRAAGBAK_STAMMDAT = new QUERY(this)
with (this.VRAAGBAK_STAMMDAT)
onOpen = class::VRAAGBAK_STAMMDAT_ONOPEN
left = 140.0
top = 94.0
width = 100.0
height = 37.0
database = form.databank_cust
sql = 'Select * from "STAMMDAT"'
active = true
endwith
with (this.VRAAGBAK_STAMMDAT.rowset)
with (fields["Country"])
lookupSQL = "select landcode,land from country" // order by
DCLANd"
endwith
with (fields["dcPostnaam"])
beforeGetValue = class::DCPOSTNAAM_BEFOREGETVALUE
endwith
autoEdit = false
indexName = "IDENTIFY"
endwith
testing
a= form.keuzedoos_land.value
?" eerste a = " + " "+ a
eerste a = Österreich // the first variable a is this one I make
arbitrair a choice in the combobox
******
a =this.parent.rowset.fields["country"].lookupRowset.Fields[2].value
or //Rowset.fields[1].value
?" tweede a = " + " "+ a
tweede a = Belgie or B if using field 1 :
i need this one field 1 because table stammdat for country.value =
B up to lookupsql..
*************
a = NULL
? "wat is a nu met waarde null"
"wat is a nu met waarde null" gvives nothing
************
form.country = this.parent.rowset.fields["country"].value
? " form.country"+" " + form.country
form.country Belgie
( form.country is :
this.KEUZEDOOS_LAND = new COMBOBOX(this)
with (this.KEUZEDOOS_LAND)
onChange = class::KEUZEDOOS_LAND_ONCHANGE
dataLink = form.vraagbak_stammdat.rowset.fields["country"]
where in the table stammdat country = B )
************
another test :
when i use filter with an arbtrair landcode D
form.rowset.filter=[country=']+"D"+[']
all filtered for country D or germany
is working
i send the fils in binairy
thanks
Dirk
Structure for table D:\DFCC_Programms\Customerinfo\Data\STAMMDAT.DBF
Table type DBASE
Version 7
Number of rows 12510
Last update 30/05/2020
-------------------------------------------------------------------------
Field Field Name Type Length Dec Index
1 IDNUMMER CHARACTER 10 N
2 Name CHARACTER 60 N
3 Street CHARACTER 50 N
4 Plz CHARACTER 10 N
5 City CHARACTER 35 N
6 Province CHARACTER 25 N
7 Country CHARACTER 3 N
8 Areacode CHARACTER 6 N
9 Basetelefon CHARACTER 25 N
10 basefax CHARACTER 25 N
11 handy CHARACTER 25 N
12 email CHARACTER 50 N
13 web CHARACTER 50 N
14 soort CHARACTER 30 N
15 choice CHARACTER 1 N
16 creatie DATE 8 N
17 outside CHARACTER 25 N
18 TAAL CHARACTER 4 N
19 Monitor LOGICAL 1 N
20 BTWNummer CHARACTER 20 N
21 btw NUMERIC 2 N
22 betalingen CHARACTER 30 N
-------------------------------------------------------------------------
** Total ** 496
tructure for table D:\DFCC_Programms\Customerinfo\Data\country.DBF
able type DBASE
ersion 7
umber of rows 62
ast update 27/05/2020
------------------------------------------------------------------------
ield Field Name Type Length Dec Index
1 landcode CHARACTER 4 N
2 Land CHARACTER 20 N
3 telcode CHARACTER 5 N
4 Iso1366 CHARACTER 4 N
5 vlag BINARY 10 N
------------------------------------------------------------------------
* Total ** 44
|
|