Forum


Table Manager Support

Table Manager Support
Forums
Public write access is disabled. Please login

Could you please supply some examples 21.11.2013 09:19

Hi, I am new to SQL and would appreciate some examples of how to enter calculations, lists etc in the "Edit Type":
- Combo from SQL and
- Calculated
using other fields and tables (or do I reference the List as set up in MS Table manager?)
Thank you

Re: Could you please supply some examples 21.11.2013 10:53

Hi,

Users combobox ("Combo from SQL") example. First you should write sql query, setting in first column the text you want to see and in second column the value saved in database (could be the same).

SELECT name, id FROM #__users;

(Note query could be written with joomla prefix #_ or directly table name)

So, when you edit field in row in frontend you should see a combo with all your users and also table you will see the name of the user.

Structure of the query is simple:

SELECT NAME_OF_COLUMN_1,NAME_OF_COLUMN_2 FROM TABLE

- Replace NAME_OF_COLUMN_1 with the name of the column with the text we want to see and replace NAME_OF_COLUMN_2 with the name of the column with the text we want to save. NAME_OF_COLUMN_1 and NAME_OF_COLUMN_2 could be the same

- Replace TABLE with the name of the table in your database.

This is a simple approach to SQL query, but you could write most complicated queries.

You could use to see database any of the applications provided by hosting, phpmyadmin, for example.

Some examples from joomla tables:

// Joomla Groups
SELECT title,id FROM #__usergroups;

// Joomla templates
SELECT template, template FROM #__template_styles;



Calculated option is a special type of field that execute PHP code on each field before showing in frontend. For example, your table has the following columns:

firstnumber, secondnumber, result

and the following data

1,2,3
1,1,2

You could set 'result' as calculated field like this:

$result='Sum is '.$result;

This will show in frontend in first row:
1,2,Sum is 3

Also you could get other fiels. For example:

$result='Multiply is '.($firstnumber*$secondnumber);

and you´ll see:
1,2,Multiply is 2

Other use could be a link generation:
$result='link';


Hope this help you with Table Manager configuration.

Regards,
Moonsoft Team
www.moonsoft.es

Re: Could you please supply some examples 25.06.2015 14:54

Calculations don't seem to work in my table: if I enter the following, 0 is displayed as a result:

$Total = ($ID + $ID);

Expected results are 2, 4 and 6, for rows with IDs 1, 2 and 3.

And in addition, what complexity is allowed? Can you use full php code, e.g. str_replace?

Re: Could you please supply some examples 25.06.2015 18:16

Hi,

Please check that 'Total' and 'ID' are column names in your table. If so, calculation field should show in 'Total' column the result expected. If not, please place a private ticket at helpdesk with more info about your table (columns and configuration) or an url and credentials of your site and we'll take a look.

About complexity, you can use str_replace or other php function.

Regards,
Moonsoft Team
www.moonsoft.es

Re: Could you please supply some examples 26.06.2015 12:49

Thanks, that did the trick!
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect

Our clients' feedback