dropdown field for a search

Fr Fredolino 12 Jun, 2019
Hi,
I want to create a dropdown field (under views) for a search.
​
the Option: {var:read_search_records}
the dropdownfield is in the form area.
​
Under Functions-Tab:
Read Data: read_search_records
in this:
Model-1: SucheBeob
DB-Table: haupttable
Select type: Return an array of key/value ...
retrieve fields: CONCAT(datum , ', ' ,beobachtung, ', ', fundort)
and
Model-2: SucheBeof
DB-Tabele: undertable
related to: "SucheBeob"
Relation: One matching record, foreign key at the related table
Foreign key: beo_id
​
I do not see all records for the search in the drop-down box.
This is due to the select type of Model-1? That must be "All matching records"?
But then my "CONCAT" will not work anymore.
​
What do I have to do?
​
F.
he healyhatman 12 Jun, 2019
Retrieving an array of key/value pairs is fine. What have you got in your Where conditions?
Fr Fredolino 12 Jun, 2019
Hi,
you were faster :-)
Just wanted to post, that I could solve the problem meanwhile.
​
many Greetings
F.
Fr Fredolino 13 Jun, 2019
Hello,
I've noticed there are still issues with the search dropdown.
I have a list of records (screen1). If I see the records in the dropdown, then one record is too much and wrong (screen2). And why is a record displayed twice?
In the dropdown I use: CONCAT (datum , ',', beobachtung, ',', fundort)
How can I convert the date here?
That did not work:
CONCAT ({date: d.m.Y $ (var: read_search_records.SearchBeob.datum)} , ',', beobachtung, ',', fundort)
​
Table-List:
17.05.2019, Am Köder, Pasewalk am Straßenrand, UM    
17.05.2019, Am Licht, Pasewalk am Straßenrand, UM   
09.05.2019, Am Tag, Klosterfelde am Waldrand, BAR
​
Dropdown-list:
2019-05-09, Am Tag, Klosterfelde am Waldrand, BAR 
2019-05-09, Am Tag, Klosterfelde am Waldrand, BAR
2019-05-17, Am Licht, Pasewalk am Straßenrand, UM
2019-05-17, Am Köder, Pasewalk am Straßenrand, UM
2019-05-17, Am Tag, Pasewalk am Straßenrand, UM
​
Many thanks for your help.
F.
​
PS. I can't upload Images and files.
he healyhatman 13 Jun, 2019
{date} won't work in there, you would need to use MYSQL to format the date.
​
Not sure why it's showing twice in your dropdown, if you're using the same read data for your table list? Or is a separate read data action and you maybe need to group the observations by ID?
Fr Fredolino 14 Jun, 2019
Hi,
how do I do that with the date?

In the tab "Functions" I create "Custom code" with the name "date_DE".

In the content I give a example:
SuBeof.datum: {date: d.m.Y $ (var: read_search_records.row.SuBeof.datum)}

Then swap in "read_search_records" in the "Fields to retrieve":
CONCAT (date, ',', beobachtung, ',', fundort) with
CONCAT ({fn: date_DE}, ',', beobachtung, ',', fundort)
​
I dont know....
F.
Fr Fredolino 14 Jun, 2019
Hi,
I have now z. B. tested these variants, but there are only error messages.

You may also have to write with models. The field "beobachtung" comes from the second table.
​
CONCAT_WS(', ',DATE_FORMAT(datum,'%d.%m.%Y'), beobachtung, fundort)
CONCAT(DATE_FORMAT(datum,"%d.%m.%Y"), ", ", beobachtung, ", ", Fundort)
he healyhatman 14 Jun, 2019
Need to have a space surround each comma like , this
Fr Fredolino 15 Jun, 2019
Hi :-)
​
CONCAT(DATE_FORMAT(datum , "%d.%m.%Y") , " , " , Beobachtung , " , " , Fundort) ??
​
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near ') AS
`CONCAT(DATE_FORMAT(datum , "%d`.`%m.%Y") , " , " , beobachtung , " , " ,
F' at line 1
This topic is locked and no more replies can be posted.