Calc element - show value on form but doesn't save to list

Hi,

I have a problem with calc element {ccjom_cc_szkolenia___multipersons_calc} that includes the same values like an element:
{ccjom_cc_szkolenia___multipersons} - "Osoby szkolone" but in other way ----

{ccjom_cc_szkolenia___multipersons} - "Osoby szkolone" - is a databasejoin-multi-select-dropdown and this include persons like:
- CC Anna White
- CC Robert Blue
- CC Tom Green
- CC Barbra Red

{ccjom_cc_szkolenia___multipersons_calc} - "Osoby szkolone calc" is a calc element and on form1 it is displayed in that way:
CC Anna White, CC Robert Blue, CC Tom Green, CC Barbra Red

I need this to store in table and display on my list1 but on list - list-view, details-view it is not displayed.

My calc element is:

Calculation:
$db =& JFactory::getDBO();
$recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';

$query = "SELECT GROUP_CONCAT(`name`) FROM `ccjom_users` WHERE `id` IN ($recipient2)";
$db->setQuery($query);
$result = $db->loadResult();

return $result;

Ajax observe fields:
'{ccjom_cc_szkolenia___multipersons}'

What can i do to get this on my list, any tip?
 

Attachments

  • Zaznaczenie_498.png
    Zaznaczenie_498.png
    41.5 KB · Views: 464
  • Zaznaczenie_499.png
    Zaznaczenie_499.png
    40 KB · Views: 468
  • Zaznaczenie_500.png
    Zaznaczenie_500.png
    37.5 KB · Views: 436
Hi,
This element {ccjom_cc_szkolenia___multipersons_calc} under phpMyAdmin seems not to have datas, :-(
 

Attachments

  • Zaznaczenie_501.png
    Zaznaczenie_501.png
    20 KB · Views: 446
  • Zaznaczenie_502.png
    Zaznaczenie_502.png
    10.9 KB · Views: 433
  • Zaznaczenie_503.png
    Zaznaczenie_503.png
    58.2 KB · Views: 451
A calc element is only stored in the database if you are saving the record.
If you've set "Only calc on save"=YES (which is not the default) in list and details view it's displaying the values from the database.
With "only calc on save"=NO (the default) it's calculating every time "on the fly".

So it depends what you need. If you need the values stored in the DB you must add the calculated value to existing records manually - either edit/resave every existing record or do it with e.g. phpMyAdmin.

If your want to have your information calculated "on the fly" to see always the recent information set your calc element back to default "only calc on save"=NO.
 
Hi troester,

For this form1 - "CC-17 - Company trainings and trained persons" i am on writing/testing stage - so i don't need any values manually using phpMyAdmin, i need write this "CC-17" and make it working properly.

So, problem is that i use calc element based od other field that is databasejoin-multi-select-dropdown first time and this doesn't display nothing on my list - not "on the fly" - not this what should be stored in DB.
When i use "Only calc on save"=YES this doesn't store data in DB :-(.

What i exactly need is "Only calc on save"=YES - this option that should store datas in DB, but this doesn't work.
The second option information calculated "on the fly" - also doesn't work,

So i can't nothing display in column with calc element on my list......
Is this any bug?

I used some numbers of calc-elements even based on databasejoin other field and they work, but i didn't use earlier calc based on field databasejoin-multi-select-dropdown

There is something wrong with this...

Is a way to solve this?
 
Dbjoin multiselect seems to be at bit complicated.
But on my Fabrik3.0 (latest GitHub) page a calc doing
return '{my-multi-dbjoin}';
is showing label1//..*..//label2 (resp. value1//..*..//value2 in case of _raw) in form/list/details so I don't understand how this can be:
"Osoby szkolone calc" is a calc element and on form1 it is displayed in that way:
CC Anna White, CC Robert Blue, CC Tom Green, CC Barbra Red

Include a var_dump($recipient2);exit; to see what you really get in $recipient2.
 
Hi,

When my code in calc element is:
$db =& JFactory::getDBO();
$recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';
var_dump($recipient2);
exit;
$query = "SELECT GROUP_CONCAT(`name`) FROM `ccjom_users` WHERE `id` IN ($recipient2)";

$db->setQuery($query);
$result = $db->loadResult();
return $result;

this returns:
string(39) "{ccjom_cc_szkolenia___multipersons_raw}"
 
Hi,
I try also:
calc code:
// $db =& JFactory::getDBO();
// $recipient2 = '{ccjom_cc_szkolenia___multipersons_raw}';
// var_dump($recipient2);
// exit;
// $query = "SELECT GROUP_CONCAT(`name`) FROM `ccjom_users` WHERE `id` IN ($recipient2)";

// $db->setQuery($query);
// $result = $db->loadResult();

// return $result;

return '{ccjom_cc_szkolenia___multipersons_raw}';


Then it save in list column for calc element value:
{ccjom_cc_szkolenia___multipersons_raw}
 

Attachments

  • Zaznaczenie_506.png
    Zaznaczenie_506.png
    11.8 KB · Views: 400
  • Zaznaczenie_507.png
    Zaznaczenie_507.png
    41.4 KB · Views: 387
Dbjoin multiselect seems to be at bit complicated.
But on my Fabrik3.0 (latest GitHub) page a calc doing
return '{my-multi-dbjoin}';
is showing label1//..*..//label2 (resp. value1//..*..//value2 in case of _raw) in form/list/details so I don't understand how this can be:

I have latest GitHub - this version is updated 28 April 2014 20:07 - i check this a moment ago - now on GitHub is still this version,
 
This is other thread - not duplicate. My latests thread are concerned with field databasejoin-multiselect-dropdown but all are different,
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top