get('table.row.Model.field')" returns nothing. So I looked at the examples and it just used '{var:Model.field}' to display them but when I try "$this->get('Model.field')" I just get the data from first row. I also tried to get the key but always returned the 1st row. In the screenshot the 'Format Date column is where I have the 'HTML field' with the PHP code, the first link is using the {var:XXX} syntax and 2nd line is trying to get from PHP. Why can't I get current row in PHP now?"> Access Table Data - Forums

Forums

Access Table Data

grantdigital 07 Sep, 2020
I am testing out Chronoforms 7 and I trying to add PHP in a table to output some data calculated in PHP.

Using the same syntax as with Chronoforms 6 "$this->get('table.row.Model.field')" returns nothing. So I looked at the examples and it just used '{var:Model.field}' to display them but when I try "$this->get('Model.field')" I just get the data from first row. I also tried to get the key but always returned the 1st row.

In the screenshot the 'Format Date column is where I have the 'HTML field' with the PHP code, the first link is using the {var:XXX} syntax and 2nd line is trying to get from PHP. Why can't I get current row in PHP now?

healyhatman 07 Sep, 2020
$this->get('tableName.row.Model.field') should definitely work. If it doesn't, try just print_r($this->get('tableNameGoesHereDontLiterallyTypeThis.row')) see what the data shows.
Max_admin 07 Sep, 2020
where do you call the PHP code and how ?
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
grantdigital 07 Sep, 2020
I am using HTML block with 'Run PHP' in Advanced settings.

Also trying var_dump($this->get('list.row')); returns NULL. In the PHP code it just getting the first row.
Max_admin 08 Sep, 2020
what is the name of your "Read Data" ? to get the name you need to move the mouse over the "Read data" action label, it will appear in a tooltip

Then use that name in the get() function call!

"list" will not return anything unless it's the name of the Read data!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
grantdigital 08 Sep, 2020
the 'list' was the name of the table element and "var_dump($this->get('read_banners.row'));" also returns null.

I can find to get the current row in ChronoForms7. In v6 it was done from the table element.

As I said originally examples just use 'Model.field' to display the data in a table. that work when doing '{var:Model.field}' But does not in PHP code. I have tried the following

Model.field = always first row's field
table.key = always first row's key (tied to use this to access the data in array)
table.row = NULL
read_data.row = NULL

Here is my PHP code and screenshots of the output. Note the boxed data is the same in every row
{var:list.key}|{var:Banner.name}<br>
<pre>
<?php
var_dump($this->get('Banner.name'));
var_dump($this->get('list.key'));
var_dump($this->get('list.row'));
var_dump($this->get('read_banners.row'));
?>
</pre>

Max_admin 08 Sep, 2020
in v7 you get the data from the "Read data", you should try:
$this->get('read_banners')
but inside the table row you can use {var:Model.field_name}
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
grantdigital 08 Sep, 2020
Using $this->get('read_banners') gives me the entire data from the database. I want the data from the current row so I can do calculations on that data. Currently, I have no way of getting the current row's data
Max_admin 08 Sep, 2020
if you want to get the current row data inside the table then use {var:Model.field} or $this->get("Model.field") inside the HTML view!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
grantdigital 09 Sep, 2020
As I said, in the PHP that always just returns the first row which you can see from the first line in the boxed text in my above screenshots. That is using the PHP code var_dump($this->get('Banner.name'));
grantdigital 15 Sep, 2020
Yes in the screenshot the 'Format Date' column uses the below code. Everything in the PHP code only every returns the first row in the data, not the current row. I tried every combination I can think of but none work correctly.
{var:list.key}|{var:Banner.name}<br>
<pre>
<?php
var_dump($this->get('Banner.name'));
var_dump($this->get('list.key'));
var_dump($this->get('list.row'));
var_dump($this->get('read_banners.row'));
?>
</pre>
shahabpk 19 Sep, 2020
Hi Max
As grantdigital pointed out, $this->get("Model.field") inside the HTML view with PHP enabled prints the first row data in all all rows of a Table List column in Chronoform 7.0.2
shahabpk 28 Sep, 2020
Hi grantdigital,
could you find a solution to this?
grantdigital 30 Sep, 2020
So I just checked with v7.0.4 and I still have the same issue.

Has no dev even checked this as no hard to replicate the issue.
Max_admin 08 Oct, 2020
Answer
this should be fixed in 7.0.5
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Elita 20 Dec, 2020
hello to all involved in this conversation- has anybody resolved this? If yes, could you type the guidlines on how to call a PHP function in the table list?
Max_admin 22 Dec, 2020
You can not call an action in the table view, you may add an HTML view and inside that enable the PHP support behavior!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Elita 22 Dec, 2020
No, sorry Max, I cannot. Actually I cannot do nothing in table views since there is a bug.
in Connectivity form in table list only FIRST (built-in) table column works. In other you cannot do NOTHING!!!
Please, fix this ASAP.
Max_admin 23 Dec, 2020
fixed in the next update!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
ieraora 15 Aug, 2021
I think it's an error also in dropdown inside table.
As images, I get value in text fiend and in dropdown, but in last the selection is wrong








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