Forums

select array record from url data shortcode

riccardoc 31 Jul, 2020
Hello, I have a text field whose value is
{var:read_data4.1.tblpicture.Original}
I want to choose the record in the array using a data shortcode in the url (adding for example &n=3 in the form url), I tried to use this string as value
{var:read_data4.{data:n}.tblpicture.Original}
but it doesn't seem to be correct, can you help me?
Max_admin 01 Aug, 2020
Answer
if you need a single record then set the read data to select a single record, or if you must have multiple records then you can choose one with PHP action:
return $this->get("read_data.".$this->data("n").".tb1picture.Original");
now use {var:php_name} to get the value!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
riccardoc 03 Aug, 2020
Thanks Max it works fine, just another question, "if you need a single record then set the read data to select a single record" how can I do that in the in read data action? I mean, I just want to read for example the 3rd (passed as data: in the url) of the array, I suppose I have to specify this in "where conditions" but I can't figure out how.
Max_admin 06 Aug, 2020
in the where conditions:

table_filed_name:{data:url_param_name}

And you should consider using v7 as the interface is more straight forward!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
riccardoc 13 Aug, 2020
Sorry Max for the late replay, "table_filed_name:{data:url_param_name}" is ok but how can I use it to select for example the second record in an array?
Didn't use v7 yet, I'm working on a production site and I prefer to wait for the stable release before.
Max_admin 16 Aug, 2020
the conditions will force the read data to return the rows matching the conditions only, if you want to select a specific item from the list then use the first method with the code!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.