Lookup Field in DataView

I use DataViews extensively in my forms. In the Generate Emails form, there is a page with a dataview to select members. entries look like:

Adams, John
Blow, Joe
Mittelman, Ron
...

Is it possible to have a search bar at the top of the DataView where I could type “smith” and have the dataview filtered for that name? This would work similar to any form with records, where you can type some text in the search bar above the records list on the left, and the records would be filtered to that name.

I found something about adding screen fields to the dataview, and it looked like it would work, but it is quite complex and just adding the screen field caused my data view to not display at all, instead a message saying it could not render the data view showed up. Then I removed the screen field and it worked again.

Perhaps I didn’t properly add the screen field. but the documentation said I needed to add functions and action buttons, and that it required using one or more of the underlying query’s parameters.

My DataViews only use UserKey as the parameter.

How can I have a search bar at the top of the DataView that works like the search bar above a form’s record list?

Alternatively, is there a way to scroll the data view until a specific record is showing instead of filtering the data view?

Thanks…

Hi Ron,

Thank you for bringing this question.

Have you seen these steps: Filter Customer | Five | Low-Code For Real Developers?

I think this application has an example you are looking for.

Please let me know if you have any questions.

Regards,
Elton S

Thanks for the suggestion Elton.
This application seems to mirror the article I read about filtering data views. But it doesn’t seem to use a DataView. There is one defined, but it is not used anywhere, according to its references. The form itself is a standard form and doesn’t seem to use a DataView.

M DataView, dvSelectedMembers, uses the dvqSelectedMembers query as its data source. That query only has UserKey as a parameter, since it is displaying records in the SelectedMembers table for that particular UserKey. the fields are UserKey, MemberKey, SortName and IsSelected.

Like the article, I added a screen field for the Dataview, called SortName. Then I changed the query to add the SortName parameter, with a value of {{five.field.SortName}}. In the query itself, I changed the Where to

WHERE `UserKey` = ?
AND SortName LIKE CONCAT('%', ?, '%')

similar to the example in the documentation.

Now, when I run the application and open the GenerateEmails form and navigate to the SelectedMembers tab, I get this:

If I open the query in design mode, and modify the Where as follows,

WHERE `UserKey` = '10000000-0000-0000-0000-000000000001'
AND SortName LIKE CONCAT('%', ?, '%')

then the query itself works fine, and returns records. So I presume that saying SortName LIKE “%%” (which it would be if the parameter is not supplied) doesn’t limit the query results at all.

So can you explain why the query can run, but the form itself with the embedded DataView will not even render?

I hope I have explained my situration properly.

UPDATE:
If I remove the screen field from the DataView entirely, everything runs normally. The query is restored to only one parameter, UserKey. Then if I add back a unique-named screen field, don’t give it a default value, then save and run, the above error comes back. I should be able to have a blank unused screen field in the DataView, right? But the moment I run and click on the SelectMembers tab, the above error returns.

Why would the DataView designer allow me to add a screen field but crash when I try to click on the form page holding that dataView?

Hi Ron,

Thank you for bringing this scenario to our attention.

Please use this link instead if you haven’t seen it already: Work With Data Views | Five | Low-Code For Real Developers

Update: I have managed to reproduce the issue and have reported it to the Development team. I will update you once it is fixed.

Regards,
Elton S