ChronoEngine.com homepage

Forums

select array record from url data shortcode

R
riccardoc posted Jul 31, 2020 at 16:09
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 posted Aug 1, 2020 at 03:29
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...
ChronoForms v8 is out, do you have any suggestions? please let us know.
R
riccardoc posted Aug 3, 2020 at 08:08
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 posted Aug 6, 2020 at 00:20
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...
ChronoForms v8 is out, do you have any suggestions? please let us know.
R
riccardoc posted Aug 13, 2020 at 10:55
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 posted Aug 16, 2020 at 22:28
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...
ChronoForms v8 is out, do you have any suggestions? please let us know.
R
riccardoc posted Aug 17, 2020 at 07:07
Good, thanks.
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com