Forums

ChronoFomrs6: read data from database table and display a list of the contents

Erik66 05 Nov, 2018
Hello,

I am trying to read a number of rows from a database table and display the contents in a list rendered with ChronoForms 6. I want ot create a simple list that outputs this from the contents of a database table:

Date Time Place
2018-11-25 21:35 Living
2018-11-05 17:35 Kitchen

I have first setup a Read Data event that fetches the data. I have given the Model Name the name "Model". This works correctly and outputs the desired data:
Array
(
    [read_data7] => Array
        (
            [log] => Array
                (
                    [0] => SELECT `Model`.`date` AS `Model.date`, `Model`.`time` AS `Model.time`, `Model`.`plek` AS `Model.plek` FROM `zhb25_chronoforms_data` AS `Model` WHERE `Model`.`user_id` = '728' ORDER BY `Model.date` DESC, `Model.time` DESC LIMIT 100;
                )
            [var] => Array
                (
                    [0] => Array
                        (
                            [Model] => Array
                                (
                                    [date] => 2018-11-25 12:33:00
                                    [time] => 21:35
                                    [plek] => Living
                                )
                        )
                    [1] => Array
                        (
                            [Model] => Array
                                (
                                    [date] => 2018-11-05 12:39:00
                                    [time] => 17:35
                                    [plek] => Kitchen
                                )
                        )
                )
        )
)
Then, I've added a Repeater Area to the Design and added a Multi Field Area to the Repeater Area body. Now here's where I have issues getting things to work. I tried to follow the CF Manual (cf6manual-1.0.2.pdf) pages 28/29 but I am confused as to how to fill all the fields correctly. I am getting no output whatsoever, ofr I'm getting blank fields. I've set up the Repeater Area "Data Provider" field with "{data:Model}" and have set"Enable COntent Multiplier" to "No". Then I have set up the fields as follows:

Within the Multi Field Area I have setup the fields as follows (field "date" as example"


This is giving no output. I've tried changing the Value field to {var:area_repeater42.key.Model.date} bu that did not change the output.

I must be misinterpreting te manual. Could anyone please help out and explain how to set the Name, ID and Value fields for this to work please?

Many thanks in advance,

Erik
healyhatman 05 Nov, 2018
Data provider should be {var:read_data7}
Value for your fields should be {var:area_repeater42.row.model.date}
Erik66 05 Nov, 2018
Thank you Healyhatman. I changed that and I now get 2 rows with fields. Unfortunately, the fields are still empty. Do you know what else needs to be changed here?

Thank you in advance, best regards from

Erik
healyhatman 05 Nov, 2018
Model with a capital M sorry since that's how you have your read data set up
Erik66 05 Nov, 2018
Thank you, that did the trick ! Great success !

Thanks again, best regards,

Erik
This topic is locked and no more replies can be posted.