mudshark79
Member
Hello, i want to ask you for some help on one special aspect in the use of calc elements. My Basic goal is to visualize a list's data usinc "helper"-calc elements to prepare the data (already achieved, could be done more elegant though for sure) BUT also to respect filtering of the list within these calc elements (the part where i hope to get help). I have prepared a special version of the site in question at shared-hosting webspace and would like to use this as an illustration and can also provide access ...
You can find it here:
http://nahtdemo1-1.biberelite.de/
use
testadmin:fabrikadmin
as a frontend-login
I have one list in the upmost Menu on the left side called "Klienten", there's a column "Erwerbseinkommen" wich is counted by total in column ErwerbseinkommenCount. This is done by a calc element doing a Query directly in the DB. It's nothing that isn't much more convenient done by the list-element-counter but read on after the PHP used in the first calc:
I have a second column "Helper" wich is also a calc_element wich ensures, that a "boolean" value of 1 or 0 indicates whether the row in the DB is the first one holding the specific value of the first column in question "Erwerbseinkommen" - only the first row holds the value of 1, all the others get a 0.
I use this construction for a visualization found in the same menu on the left at "Demovisualisierung",the helper element makes sure that every counted-up value of Erwerbseinkommen is shown only once.
Despite of the fact that the calc-code for sure is quite ineffective and would not perform on a big scale: I'm looking for a way to make this thing sensitive of the filtering of the list. For Example if use the filter for "Standorte" and only show, say, "unbekannt" the helper-element should reflect on this, but of course it doesn't.
I have found several questions regarding counting and visualization that go into this direction but only the thread that comes closest is this one?:
http://fabrikar.com/forums/index.php?threads/row-counter.26928/
To sum it up:
There definitely is a solution with incorporating the whole logic into one top-of-the-pops sql-query (that i'm far away from understanding), last but not least the Element counter beneath the list does the same...
Question:
Can i somehow do a visualisation of the result of the List-Calculation?
But even more interesting: Is there a different approach I'm not aware of? Couldn't I use the "list-count-code" in a calc element, how is this whole counting and calculation beneath the list done? Can I use some list-Php Plugin to read the lists data on page load, do the logic, override certain values and giving them back before the visualization logic kicks in (I already feel quite familiar with form-plugins)?
So far and quite confused ... please PM me for backend-access, i appreciate every feedback...
You can find it here:
http://nahtdemo1-1.biberelite.de/
use
testadmin:fabrikadmin
as a frontend-login
I have one list in the upmost Menu on the left side called "Klienten", there's a column "Erwerbseinkommen" wich is counted by total in column ErwerbseinkommenCount. This is done by a calc element doing a Query directly in the DB. It's nothing that isn't much more convenient done by the list-element-counter but read on after the PHP used in the first calc:
PHP:
$id = '{01_klienten___erwerbseinkommen_id_raw}';
$db = FabrikWorker::getDbo(true, 2);
$sql = "SELECT erwerbseinkommen_id FROM 01_klienten WHERE erwerbseinkommen_id = $id";
$db->setQuery($sql);
$einkommens = $db->loadObjectList();
$count = 0;
foreach($einkommens as $einkommen)
{
$count = $count + 1;
}
return $count;
I have a second column "Helper" wich is also a calc_element wich ensures, that a "boolean" value of 1 or 0 indicates whether the row in the DB is the first one holding the specific value of the first column in question "Erwerbseinkommen" - only the first row holds the value of 1, all the others get a 0.
PHP:
$erwerbs_id = '{01_klienten___erwerbseinkommen_id_raw}';
$id = '{01_klienten___id_raw}';
$db = FabrikWorker::getDbo(true, 2);
$sql = "SELECT id FROM 01_klienten WHERE erwerbseinkommen_id = $erwerbs_id";
$db->setQuery($sql);
$einkommens = $db->loadObjectList();
$disp = array();
foreach($einkommens as $einkommen)
{
$array = (array)$einkommen;
$disp[] = $array[id];
//echo "<pre>";print_r($disp);echo "<pre>";
}
if ($disp[0] == $id){
$db =&JFactory::getDBO();
$db->setQuery("UPDATE 01_klienten SET erwerbseinkommenauswhelper_calc = '1' WHERE id = '$id'");
$db->query();
return 1;
}else{
$db = FabrikWorker::getDbo(true, 2);
$db->setQuery("UPDATE 01_klienten SET erwerbseinkommenauswhelper_calc = '0' WHERE id = '$id'");
if (!$db->query()) {
var_dump($db->getErrorMsg()); exit;
};
return 0;
}
I use this construction for a visualization found in the same menu on the left at "Demovisualisierung",the helper element makes sure that every counted-up value of Erwerbseinkommen is shown only once.
Despite of the fact that the calc-code for sure is quite ineffective and would not perform on a big scale: I'm looking for a way to make this thing sensitive of the filtering of the list. For Example if use the filter for "Standorte" and only show, say, "unbekannt" the helper-element should reflect on this, but of course it doesn't.
I have found several questions regarding counting and visualization that go into this direction but only the thread that comes closest is this one?:
http://fabrikar.com/forums/index.php?threads/row-counter.26928/
To sum it up:
There definitely is a solution with incorporating the whole logic into one top-of-the-pops sql-query (that i'm far away from understanding), last but not least the Element counter beneath the list does the same...
Question:
Can i somehow do a visualisation of the result of the List-Calculation?
But even more interesting: Is there a different approach I'm not aware of? Couldn't I use the "list-count-code" in a calc element, how is this whole counting and calculation beneath the list done? Can I use some list-Php Plugin to read the lists data on page load, do the logic, override certain values and giving them back before the visualization logic kicks in (I already feel quite familiar with form-plugins)?
So far and quite confused ... please PM me for backend-access, i appreciate every feedback...