Subject |
Re: need on some Sql help |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Wed, 1 Mar 2023 22:13:09 +0200 |
Newsgroups |
dbase.getting-started |
On 2023/03/01 19:27, Dirk wrote:
> Hello,
>
> when i test with .... where crossvolgnr ="0000000789" i get only the
> crossartikelnr i need in the grid,all with the same crossvolgnr whats
> ok, but when i use a params i only get 1 crossartikelnr, of course when
> their is only ono, you got one, but if more crossartikelnr i also only
> get one ?
>
> sql = 'select eigenvolgnr, crossvolgnr, crossleverancierid, segmenten,
> crossbrandnr, crossproductnr, crossartikelnr, crossingavedatum from
> artikelcross where crossvolgnr =""'
> // params["test"] = "%"
> requestLive = false
>
> the purpose is: putting a ref in the searchfield and getting all the
> crossartikelnr in the grid linked on the crossvolgnr
q = new query()
q.sql = 'select eigenvolgnr, crossvolgnr, crossleverancierid, segmenten,
q.sql +='crossbrandnr,crossproductnr,crossartikelnr,crossingavedatum '
q.sql += 'from artikelcross where crossvolgnr = :volgnr '
q.params["volgnr"] = "0000000789"
q.requestLive = false // do you really need this?
q.active = true
To show records for a different cosssvolgnr in the grid datalinked to
the query
q.params['volgnr'] = "0000000800"
q.requery()
>
> how it's working:
>
> a main table is populated with an artikelnr
>
> sql = "select volgnr,brandnr,artikelnr from artikels.dbf"
>
> by saving the a secondtable artikel cross get the same ref from the main
> table Artikels volgnr is fK for crossvolgnr, afterwards i can populate
> the secondtables with more reference
>
> now i want to filter the artiklecross table with only the
> crossartikelnnr with the same crossvolgnr
>
> i should pleased getting a some info about,
>
> thank you
> dirk,
I assume you want to display the records from artikels.dbf and
atrikelcross.dbf in two separate grids. If you select a record in the
artikels grid you want to show the relevant records from
artikelcross.dbf in the second grid.
q1 = new query()
q1.sql = 'select volgnr,brandnr,artikelnr from artikels.dbf1
q1.active = true
q = new query()
q.sql = 'select eigenvolgnr, crossvolgnr, crossleverancierid, segmenten,
q.sql +='crossbrandnr,crossproductnr,crossartikelnr,crossingavedatum '
q.sql += 'from artikelcross where crossartikelnr = :artikelnr '
// parameter name is name of field in master rowset to be matched
q.masterSource = q1.rowset
q.active = true
Mervyn.
|
|