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.
Retrieving an array of key/value pairs is fine. What have you got in your Where conditions?
Hi,
you were faster :-)
Just wanted to post, that I could solve the problem meanwhile.
many Greetings
F.
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.
{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?
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.
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)
Need to have a space surround each comma like , this
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