Unable to display database table content using Table List

erichon 07 Jun, 2019
Hi,
I setup a CF to get records from a database table.
It works fine if "First matching record” is chosen, the record can be displayed.  I use {var:read_data3.Product.name} to display the content.
However, if “All matching record” is used, nothing shown can be shown.
I think I may wrongly use the {var:read_data3.Product.name} in the design section, 
but have no Idea what to do to fix the problem.
Thanks a lot in advance for your help.
healyhatman 08 Jun, 2019
If you get all matching, you're not getting ONE record you're getting all the matching records. So instead of {var:read_data#.model.field} you need to use {var:read_data#.[index].model.field} where [index] is a number from 0 to however many records you have.

How exactly are you trying to display the data?
erichon 08 Jun, 2019
Dear Healyhatman,

Thanks for your helpful advice.

I try to achieve the following:

If there are 3 matched records, then I can show these three records in a table, if there are 4 matched records, then these four records will be shown in a table and so on...

I also want to click on a record, so that I can be redirected to another CF for update or delete.

Is this possible?


Regards,
Eric
healyhatman 08 Jun, 2019
Yeah that's all fine. You can use {var:read_data3} as the data source for your list, and put the columns in accordingly
Unable to display database table content using Table List image 1


And in the Cell to show the data you would use {var:llist_table###.row.Model.Fieldname}
A link to the record you could do using id={var:list_table###.row.Model.id} as a URL parameter in the link.
erichon 09 Jun, 2019
Hi Healyhatman,

Really appreciate your help, the problem is fixed, thank you very very much.

Regards,
Eric
This topic is locked and no more replies can be posted.