Buy Now
Sign in

dropdown field for a search

Fredolino , June 12 2019, 15:05
Fredolino 376
June 12 2019, 15:05 #387429
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.
healyhatman 7
June 12 2019, 21:46 #387436
Retrieving an array of key/value pairs is fine. What have you got in your Where conditions?
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
Fredolino 376
June 12 2019, 22:25 #387441
Hi,
you were faster :-)
Just wanted to post, that I could solve the problem meanwhile.
many Greetings
F.
Fredolino 376
June 13 2019, 21:35 #387473
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.
healyhatman 7
June 13 2019, 21:49 #387475
{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?
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
Fredolino 376
June 14 2019, 15:45 #387508
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.
Fredolino 376
June 14 2019, 20:08 #387510
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)
healyhatman 7
June 14 2019, 22:10 #387514
Need to have a space surround each comma like , this
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
Fredolino 376
June 15 2019, 09:00 #387526
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