[Chronoforms6] Beginner -- Show data from database accordingly to "id"

dw dwirianto 12 Nov, 2019
Hello all! It's really nice to be part of the community.
​
I want to understand how Chronoforms6 read data works in general. I've tried to use forums' search feature but it's kinda hard for me to get a straightforward answer to this. It's related to how to read data and show them in the form view.
​
BACKGROUND
​
Say that I have items on a page. Each items have a link with unique id. Each items also have data stored in database. So I have entities with ids.
​
Then, I have a form (Chronoforms6) in another page with blank fields and ready to rock.
​
USE CASE
​
When user select an item, they will get to the form with unique id in the url as identifier, for an example:
https://domain_name/form_page_name?id=5
The form has view and id shown below:
Array
(
[id] => 5
[Itemid] => 131
[option] => com_chronoforms6
[view] => form
)
​
HOW TO GET DATA?
​
In this case I want to learn and intent to get the id=5 title stored in database and show them into a field name='title' (labeled as Destination, as seen on screenshot below). This should work based on user selection and I have data as follows:
Array
(
[read_k2] => Array
(
[log] => Array
(
[0] => SELECT `destination`.`id` AS `destination.id`, `destination`.`title` AS `destination.title` FROM `utgis_k2_items` AS `destination` ORDER BY `destination.id` DESC LIMIT 100;
)

[var] => Array
(
[9] => Irure consectetur ipsum minim do.
[8] => Ipsum mollit dolor ut incididunt voluptate.
[7] => Laborum irure cillum enim exercitation ex incididunt.
[6] => Aute minim labore adipisicing reprehenderit.
[5] => I want to show this title in the field labeled as Destination
[4] => Nulla ipsum eiusmod cillum occaecat magna.
[3] => Dolor mollit deserunt excepteur mollit est laborum incididunt et dolor laboris ex culpa.
[2] => Magna enim sunt nisi qui reprehenderit et Lorem id ut in occaecat in.
[1] => Sit nulla sint duis deserunt eu laborum id do.
)

)

)
Read Data results: [id_number] => title populated from items' data.
​
Form screenshot as follows:
[Chronoforms6]  Beginner -- Show data from database accordingly to
​
​
​
I don't want to pass the data and put them in url for many basic security reasons. I hope it's clear and thank you so much for your help.
​
-Dwi
dw dwirianto 12 Nov, 2019
Thanks @healyhatman. You are correct, {data:parameter} will give me 5. But, what I really need is to get the title. If you look at to my Read Data [read_k2] results:
[id_number] => Title_goes_here
So, I need to get "Title_goes_here". Could it be possible in CF6 shortcodes or should I use another approaches?
dw dwirianto 12 Nov, 2019
Oh, I get it now. I forgot to apply Conditions. Kudos to @healyhatman.
​
For my case, I apply and use where "destination.id" = {data:id} in my Read Data action tab and then use {var:destination.title} in Destination field.
This topic is locked and no more replies can be posted.