How to write "split php" for custom calc when need split by values from 2 columns?

Hi,
I have Joomla 2.5 and fabrik 3.09.
I have table1 with records that incudes production-modules of devices ordered by our customers.

This is device-production-modules table1.

Each record includes fields like: customer, order no, device-modules.
I have multiple columns with device-modules about 30.
Our modules are for example:

Pakiet_AA {ccjom_cc_kk_karta_rejestr___is_pak_xxxx}
Pakiet_AB --- {ccjom_cc_kk_karta_rejestr___is_pak_xxab}
Pakiet_AC --- {ccjom_cc_kk_karta_rejestr___is_pak_xxac}
Pakiet_AD --- {ccjom_cc_kk_karta_rejestr___is_pak_xxad}

In really, Pakiet_AA means place/area/box inside a case where i can input physical module like/with production names like:
1. 4 x (In/50I)
2. 3 x (In/50In) +Io
3. In/2In + X + 3Un + X
4. 2 x (In/2In) + 2 x 3Un
5. 4 x 2Un
6. 3 x 1.22Un + 2Un
7. 3 x (In/50In) + X

I can input in hole/place Pakiet_AA and Pakiet_AB some 1-of-7 module. I use the same productional-modules for hole/place Pakiet_AA and Pakiet_AB.


In table1 customer order no: "15009" include 21 rows/records with devices.

I need count physical productional-modules for 1 order.

I count "what i have" in hole/place Pakiet_AA and in hole/place Pakiet_AB.
On screen shoot you can see:
Pakiet_AA ---- AA:
Pakiet_AB ----AB:
for order no 15009
This counting for AA and AB is splitted itself by physical-productional-module wchich is input in hole/place AA and AB.

I would count together Pakiet_AA + Pakiet_AB
and also split this by all values that are in column (Pakiet_AA and Pakiet_AB)

I can count Pakiet_AA + Pakiet_AB ---- number of modules is : Count(AA + AB): 42 --- screenshot

But have no idea how to write in box "split php" to split by values from those 2 column (Pakiet_AA + Pakiet_AB).

Can i get any help how to write this condition - split php by values from 2 columns/fields?
 

Attachments

  • 2015-09-08_calculation1.png
    2015-09-08_calculation1.png
    11.8 KB · Views: 451
  • 2015-09-08_220258.png
    2015-09-08_220258.png
    12.2 KB · Views: 446
  • 2015-09-08_214444.png
    2015-09-08_214444.png
    38 KB · Views: 419
  • 2015-09-08_214249.png
    2015-09-08_214249.png
    53 KB · Views: 446
  • 2015-09-08_214053.png
    2015-09-08_214053.png
    35.6 KB · Views: 452
  • 2015-09-08_223045.png
    2015-09-08_223045.png
    41.8 KB · Views: 450
Last edited:
I don't think you can, by the time the code arrives at the split php calculation it has already been run so your two counts have already been added together
 
I am not sure what you say? Is possible to write this "split php" code?Is possible to do this in other way? I very need this.

I try this in split-php, but this do nothing:
PHP:
$names1 = array('ccjom_cc_kk_karta_rejestr___is_pak_xxxx');

$names2 = array('ccjom_cc_kk_karta_rejestr___is_pak_xxab');

$names3 = $names1 + $names2;

return $names3;

And this simple also doesn't work/do nothing:
PHP:
$names1 = array('ccjom_cc_kk_karta_rejestr___is_pak_xxxx');

$names2 = array('ccjom_cc_kk_karta_rejestr___is_pak_xxab');

return $names1;


I try also this, also doesn't work:

PHP:
$ratings = array('ccjom_cc_kk_karta_rejestr___is_pak_xxxx', 'ccjom_cc_kk_karta_rejestr___is_pak_xxab');
$total1 = 0;
foreach ($ratings as $rating)
{
  $value = JArrayHelper::getValue($data, $rating . '_raw', array());
  $thisSum = is_array($value) ? array_sum($value) : $value;
  $total1 += $thisSum;
}
return $total1;

I try also array that include all 4 existed values, also do nothing:
PHP:
$names1 = array('ccjom_cc_kk_karta_rejestr___is_pak_xxxx');

$names2 = array('2 x (In/2In) + 2 x 3Un','3 x (In/50In) +Io','4 x 2Un','In/2In + X + 3Un + X');

return $names2;

And also try this:
PHP:
$names1 = array('ccjom_cc_kk_karta_rejestr___is_pak_xxxx');

$names2 = array('2 x (In/2In) + 2 x 3Un','3 x (In/50In) +Io','4 x 2Un','In/2In + X + 3Un + X');

return stats_standard_deviation($names2);



:-(
 
Last edited:
I don't think its possible with the standard calculations.
I would recommend writing a custom template to perform the calculation and embed it in the list view.
 
Hmmm, advice OK, i try in my own custom template add code:
PHP:
                                        echo "<td>";
                                        echo "<br/> test dodania w kodzie wlasnej tablicy <br/>";
                                $myArray = array("Kyle","Ben","Sue","Phil","Ben","Mary","Sue","Ben");
                                $newArray = array_count_values($myArray);

                                foreach ($newArray as $key => $value) {
                                echo "$key ------ <strong>$value</strong> <br />"; }


                                  echo "test - Tablica2 ----- <br/>";


                                   foreach( $output as &$row) {
                                   $row->{ccjom_cc_kk_karta_rejestr___is_pak_xxxx} = 0;
                                   $row->{ccjom_cc_kk_karta_rejestr___is_pak_xxab} = 1;}
                                echo array_key_exists($groupedby, $output->grouped) ? $output->grouped[$groupedby] : $output->calc, $n;

                                        echo "</td>";

It works for example-sample with $newArray
Doesn't work for "what i try --- add values from 2 fields".

I get in my list, in "area for summing" this:
Code:
test dodania w kodzie wlasnej tablicy
Kyle ------ 1
Ben ------ 3
Sue ------ 2
Phil ------ 1
Mary ------ 1
test - Tablica2 -----
Notice: Undefined variable: output in /var/www/cc.joomla/components/com_fabrik/views/list/tmpl/default-2015-09-11-table-kp5/default.php on line 221 Warning: Invalid argument supplied for foreach() in /var/www/cc.joomla/components/com_fabrik/views/list/tmpl/default-2015-09-11-table-kp5/default.php on line 221 Notice: Undefined variable: output in /var/www/cc.joomla/components/com_fabrik/views/list/tmpl/default-2015-09-11-table-kp5/default.php on line 224 Notice: Trying to get property of non-object in /var/www/cc.joomla/components/com_fabrik/views/list/tmpl/default-2015-09-11-table-kp5/default.php on line 224 Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/cc.joomla/components/com_fabrik/views/list/tmpl/default-2015-09-11-table-kp5/default.php on line 224 Notice: Undefined variable: output in /var/www/cc.joomla/components/com_fabrik/views/list/tmpl/default-2015-09-11-table-kp5/default.php on line 224 Notice: Trying to get property of non-object in /var/www/cc.joomla/components/com_fabrik/views/list/tmpl/default-2015-09-11-table-kp5/default.php on line 224 42


Is possible to get second advice how to write:
$output
for rows with 2 fields:
{ccjom_cc_kk_karta_rejestr___is_pak_xxxx}
{ccjom_cc_kk_karta_rejestr___is_pak_xxab}

and:
echo "with split condition"

? :)

Longer in size my code is:
PHP:
<td colspan="7"><table class="rysio1"> 
                     <?php  $i=0;
                        foreach ($this->calculations as $cal) {


if($i >= 32 and $i<=41)  {
                                 echo '<tr class="fabrik_calculations">';
                                        echo "<td>"; 
                                        echo array_key_exists($groupedby, $cal->grouped) ? $cal->grouped[$groupedby] : $cal->calc;
                                        echo "</td>";
                                        echo  "</tr>";
}
$i++;
}
                            ?>
<?php  $n=0;
                        foreach ($this->calculations as $cal) {
if($n >= 42 and $n<=43)  {
                                 echo '<tr class="fabrik_calculations">';
                                        echo "<td>"; 
                                        echo "<br/> test dodania w kodzie wlasnej tablicy <br/>";
                                $myArray = array("Kyle","Ben","Sue","Phil","Ben","Mary","Sue","Ben");
                                $newArray = array_count_values($myArray);

                                foreach ($newArray as $key => $value) {
                               echo "$key ------ <strong>$value</strong> <br />"; }
                                  echo "test - Tablica2 ----- <br/>";
                                   foreach( $output as &$row) {
                                   $row->{ccjom_cc_kk_karta_rejestr___is_pak_xxxx} = 0;
                                   $row->{ccjom_cc_kk_karta_rejestr___is_pak_xxab} = 1;}
                                echo array_key_exists($groupedby, $output->grouped) ? $output->grouped[$groupedby] : $output->calc, $n;

                                        echo "</td>";
                                        echo  "</tr>";
}
$n++;
}
                            ?>

                                        </table> 
                                        </td>
 
Last edited:
Sorry I just don't understand your code or what you are trying to do.
The error suggests that $output is not defined or not an object
It looks like it should be the $cal value that you are outputting perhaps?
 
I try under fabrik write something like:

PHP:
 echo "<td>";
                                        echo "<br/> test dodania w kodzie wlasnej tablicy <br/>";
                                $myArray = array("Kyle","Ben","Sue","Phil","Ben","Mary","Sue","Ben");
                                $newArray = array_count_values($myArray);

                                foreach ($newArray as $key => $value) {
                                echo "$key ------ <strong>$value</strong> <br />"; }

echo "Like this simple-sample i need the same for my 2 fields in fabrik<br/>";
                                  echo "test - Tablica2 ----- <br/>";
                                   foreach( $cal as &$row) {
                                   $row->{ccjom_cc_kk_karta_rejestr___is_pak_xxxx} = 0;
                                   $row->{ccjom_cc_kk_karta_rejestr___is_pak_xxab} = 1;}
                                $newcal = array_count_values($cal);
                                  foreach ($newcal as $key => $value) {
                                echo "$key ------ <strong>$value</strong> <br />"; }

                                        echo "</td>";


First step --- i try to create an array called $cal, in array $cal i need to place all values from 2 fields:
{ccjom_cc_kk_karta_rejestr___is_pak_xxxx}
and {ccjom_cc_kk_karta_rejestr___is_pak_xxab}


I need to point rows for those 2 fields:
{ccjom_cc_kk_karta_rejestr___is_pak_xxxx}
and {ccjom_cc_kk_karta_rejestr___is_pak_xxab}

Get values from those 2 fields where:
{ccjom_cc_kk_karta_rejestr___zamow_symbol}='15008'
or for other example:
where:
{ccjom_cc_kk_karta_rejestr___zamow_symbol}='15022'



It would be best if pointed rows would be the same as for $cal in this original fabrik code:
<td colspan="7"><table class="rysio1">
<?php $i=0;
foreach ($this->calculations as $cal) {


if($i >= 32 and $i<=41) {
echo '<tr class="fabrik_calculations">';
echo "<td>";
echo array_key_exists($groupedby, $cal->grouped) ? $cal->grouped[$groupedby] : $cal->calc;
echo "</td>";
echo "</tr>";
}
$i++;
}

this code is in my file default.php in my custom template for list1.
This code is something modified by me to display sum/count/calculation results not under columns but somewhere else "under table with records".
results given from: element---list-view-settings---calculations
 
Last edited:
I still don't get what you PHP is trying to do (sorry!)
However, you are really going about this wrong in my mind.
You would find it a lot simpler to write an SQL query to the database to get exactly what data you need rather than trying to fudge existing calculations to do something they were not intended for.
 
:confused:
I am not advanced in php.
But now, i write sample of code that works - and is a bit similar to this what i need:
PHP:
echo "----- test - Table2 - real example ----- <br/>";
$db =& JFactory::getDBO();
$pakaa = '{ccjom_cc_kk_karta_rejestr___is_pak_xxxx_raw}';
$nrzam = '{ccjom_cc_kk_karta_rejestr___zamow_symbol_raw}';

$query = "SELECT  `is_pak_wejsc_analog_aa` FROM `ccjom_cc_kk_is_aa` ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

echo "$result ---- ddddd <br/>";

$res = mysql_query($query);
$rrra=array();
$b=0;
while($row = mysql_fetch_array($res))
  {
  $rrra[$b]=  $row['is_pak_wejsc_analog_aa'];
$b++;
  }

echo $rrra, "<br/>";
$newrrra = array_count_values($rrra);
  foreach ($newrrra as $key => $value) {
  echo "$key ------ <strong>$value</strong> <br />"; }

this gives result:
Code:
----- test - Table2 - real example -----
4 x (In/50In) ---- ddddd
Array
4 x (In/50In) ------ 1
3 x (In/50In) +Io ------ 1
In/2In + X + 3Un + X ------ 1
2 x (In/2In) + 2 x 3Un ------ 1
4 x 2Un ------ 1
3 x 1.22Un + 2Un ------ 1
3 x (In/50In) + X ------ 1

My real code for real tables should be something like this, this works but is not exactly this what i need:
PHP:
echo "----- test - Table3and4 - real example ----- <br/>";
$db =& JFactory::getDBO();
$pakaa = '{ccjom_cc_kk_karta_rejestr___is_pak_xxxx_raw}';
$nrzam = '{ccjom_cc_kk_karta_rejestr___zamow_symbol_raw}';

$query = "SELECT  `is_pak_xxxx` FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

echo "$result ---- table3and4 <br/>";


$resaa = mysql_query($query);
$rrraa=array();
$n=0;
while($row = mysql_fetch_array($resaa))
   {
       $rrraa[$n]=  $row['is_pak_xxxx'];
$n++;
               }

echo $rrraa, "<br/>";
$newrrraa = array_count_values($rrraa);
                                foreach ($newrrraa as $key => $value) {
                               echo "$key ------ <strong>$value</strong> <br />"; }

this gives result:
Code:
----- test - Table3and4 - real example -----
4 ---- table3and4
Array
4 ------ 30
2 ------ 26


But i need result like this:
Code:
----- test - Table3and4 - real example -----
4 ---- table3and4
Array
2 x (In/2In) + 2 x 3Un ------ 30
3 x (In/50In) +Io: ------ 26

Field: {ccjom_cc_kk_karta_rejestr___is_pak_xxxx} is a databasejoin dropdown to table ccjom_cc_kk_is_aa___ and should show Label:
{ccjom_cc_kk_is_aa___is_pak_wejsc_analog_aa} not value: {ccjom_cc_kk_is_aa___id}

1.Is possible to write query to get labels for field {ccjom_cc_kk_karta_rejestr___is_pak_xxxx} ?

2. How to code modification of query:
$query = "SELECT `is_pak_xxxx` FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2' ORDER BY `id`";


I need something like this:
$query = "SELECT `is_pak_xxxx` FROM `ccjom_cc_kk_karta_rejestr` WHERE (`rodzaj_karty_np_wzorzec`='2' and `zamow_symbol`='.$searchresult1.' )ORDER BY `id`";

$searchresult1 should be pointed on lmy list1 in "Search"="Szukaj" , for example:
Nr zam. --- `zamow_symbol` = '15008' like on screenshot.

I need this my "custom calculation" together with other standard calculations for single columns on my list1 that i do with element---List-view-settings---calculations.


Added:
My whole code is:
PHP:
echo "----- Test - tablica z obsadzeniami pakietow ----<br/>";
$db =& JFactory::getDBO();

$query = "SELECT  `id`, `is_pak_wejsc_analog_aa` FROM `ccjom_cc_kk_is_aa` ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

$res = mysql_query($query);
$rrra=array();
$b=1;
while($row = mysql_fetch_array($res))
   {
       $rrra[$b]=  $row['is_pak_wejsc_analog_aa'];
$b++;
               }

echo $rrra, "<br/>";
$newrrra = array_count_values($rrra);
                                foreach ($newrrra as $key => $value) {
                               echo "$key ------ <strong>$value</strong> <br />"; }

echo "----- Test AA ---- Suma pakietow AA:   <br/>";
$db =& JFactory::getDBO();
$pakaa = '{ccjom_cc_kk_karta_rejestr___is_pak_xxxx_raw}';
$nrzam = '{ccjom_cc_kk_karta_rejestr___zamow_symbol_raw}';

$query = "SELECT  `is_pak_xxxx` FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

$resaa = mysql_query($query);
$rrraa=array();
$n=0;
while($row = mysql_fetch_array($resaa))
   {
       $rrraa[$n]=  $row['is_pak_xxxx'];
$n++;
               }

echo $rrraa, "<br/>";
$newrrraa = array_count_values($rrraa);
                                foreach ($newrrraa as $key => $value) {
                               echo "$key ------ <strong>$value</strong> <br />"; }

echo "----- Test AABCD ---- suma pakietow AA, AB, AC, AD: ----- <br/>";
$db =& JFactory::getDBO();
$pakaa = '{ccjom_cc_kk_karta_rejestr___is_pak_xxxx_raw}';
$nrzam = '{ccjom_cc_kk_karta_rejestr___zamow_symbol_raw}';

$query = "SELECT  `is_pak_xxxx`  FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

$resaa = mysql_query($query);
$rrraa=array();
$n=0;
while($row = mysql_fetch_array($resaa))
   {
       $rrraa[$n]=  $row['is_pak_xxxx'];
$n++;
               }

$query = "SELECT  `is_pak_xxab`  FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

$resab = mysql_query($query);


while($row = mysql_fetch_array($resab))
   {
       $rrraa[$n]=  $row['is_pak_xxab'];
$n++;
               }

$query = "SELECT  `is_pak_xxac`  FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

$resac = mysql_query($query);


while($row = mysql_fetch_array($resac))
   {
       $rrraa[$n]=  $row['is_pak_xxac'];
$n++;
               }
$query = "SELECT  `is_pak_xxad`  FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

$resad = mysql_query($query);

while($row = mysql_fetch_array($resad))
   {
       $rrraa[$n]=  $row['is_pak_xxad'];
$n++;
               }

echo $rrraa, "<br/>";
$newrrraa = array_count_values($rrraa);
                                foreach ($newrrraa as $key => $value) {
                               echo "$key ------ <strong>$value</strong> <br />"; }

echo " ---- Koniec testu sumy pakietow AA, AB,AC,AD ----";


and result is:
Code:
----- Test - tablica z obsadzeniami pakietow ----
Array
4 x (In/50In) ------ 1
3 x (In/50In) +Io ------ 1
In/2In + X + 3Un + X ------ 1
2 x (In/2In) + 2 x 3Un ------ 1
4 x 2Un ------ 1
3 x 1.22Un + 2Un ------ 1
3 x (In/50In) + X ------ 1
----- Test AA ---- Suma pakietow AA:
Array
4 ------ 30
2 ------ 26
----- Test AABCD ---- suma pakietow AA, AB, AC, AD: -----
Array
4 ------ 86
2 ------ 45
5 ------ 86
7 ------ 7
---- Koniec testu sumy pakietow AA, AB,AC,AD ----

I need exactly this piece of code that gives the result:
----- Test AABCD ---- suma pakietow AA, AB, AC, AD: -----
Array
4 ------ 86
2 ------ 45
5 ------ 86
7 ------ 7

But should be:
----- Test AABCD ---- suma pakietow AA, AB, AC, AD: -----
Array
2 x (In/2In) + 2 x 3Un ------ 86
3 x (In/50In) +Io ------ 45
4 x 2Un ------ 86
3 x (In/50In) + X ------ 7


and should be possible to count this only for rows where Nr.zam is pointed in search/szukaj table.
 

Attachments

  • Zaznaczenie_070.png
    Zaznaczenie_070.png
    33.9 KB · Views: 378
Last edited:
Hi, i have nearly what i need but i can't write myself option for $filter settings what is done for standard fabrik calculations, my code is:
PHP:
<tr><td>1</td>
                                        <td><table class="rysio1">
                     <?php   $h=0;
                          foreach ($this->calculations as $cal) {

if($h < 1)  {
                               echo '<tr>';
                                        echo "<td>";
                                        echo array_key_exists($groupedby, $cal->grouped) ? $cal->grouped[$groupedby] : $cal->calc;
                                        echo "</td>";
                                        echo  "</tr>";
}
$h++;
}
                              ?>
                                        </table></td>
                              
<td colspan="5"><table class="rysio1">
                     <?php  $j=0;
                        foreach ($this->calculations as $cal) {
if($j>=2 and $j<= 7)  {
                                 echo '<tr class="fabrik_calculations">';
                                        echo "<td>";
                                        echo array_key_exists($groupedby, $cal->grouped) ? $cal->grouped[$groupedby] : $cal->calc, $j;
                                        echo "</td>";
                                        echo  "</tr>";
}
$j++;
}                            ?>

<?php  $n=0;
                        foreach ($this->calculations as $cal) {
if($n >= 42 and $n<43)  {
                                 echo '<tr class="fabrik_calculations">';
                                        echo "<td>";

echo "----- Test 1 --- Sum  pakietow AA:   <br/>";
$db =& JFactory::getDBO();

$query = "SELECT  `is_pak_xxxx` FROM  `ccjom_cc_kk_karta_rejestr` WHERE  `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

$resaa = mysql_query($query);
$rrraa=array();
$n=0;
while($row = mysql_fetch_array($resaa))
   {
       $rrraa[$n]=  $row['is_pak_xxxx'];
$n++;
               }
$newrrraa = array_count_values($rrraa);
                                foreach ($newrrraa as $key => $value) {
$query = "SELECT  `is_pak_wejsc_analog_aa` FROM  `ccjom_cc_kk_is_aa` WHERE `id`=$key ";
$db->setQuery($query);
$result1 = $db->loadResult();
echo "$result1 ------ <strong>$value</strong> <br />"; }
echo "<br/>";
echo "----- Test 2 ---- Sum pakietow AA, AB, AC, AD: ----- <br/>";
$db =& JFactory::getDBO();

$query = "SELECT  `is_pak_xxxx`  FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();

$resaa = mysql_query($query);
$rrraa=array();
$n=0;
while($row = mysql_fetch_array($resaa))
   {
       $rrraa[$n]=  $row['is_pak_xxxx'];
$n++;               }

$query = "SELECT  `is_pak_xxab`  FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";

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

while($row = mysql_fetch_array($resab))
   {
       $rrraa[$n]=  $row['is_pak_xxab'];
$n++;
               }

$query = "SELECT  `is_pak_xxac`  FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();
$resac = mysql_query($query);

while($row = mysql_fetch_array($resac))
   {
       $rrraa[$n]=  $row['is_pak_xxac'];
$n++;               }

$query = "SELECT  `is_pak_xxad`  FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2'  ORDER BY `id`";
$db->setQuery($query);
$result = $db->loadResult();
$resad = mysql_query($query);

while($row = mysql_fetch_array($resad))
   {
       $rrraa[$n]=  $row['is_pak_xxad'];
$n++;               }

$newrrraa = array_count_values($rrraa);
                                foreach ($newrrraa as $key => $value) {
$query = "SELECT  `is_pak_wejsc_analog_aa` FROM  `ccjom_cc_kk_is_aa` WHERE `id`=$key ";
$db->setQuery($query);
$result2 = $db->loadResult();
echo "$result2 ------ <strong>$value</strong> <br />"; }
echo "<br/>";
echo " ---- END TEST 1 and 2  ----";
?>
</td>

  <?php  $j=0;
                        foreach ($this->calculations as $cal) {
if($j>=8 and $j<= 9)  {
                                 echo '<tr class="fabrik_calculations">';
                                        echo "<td>";
                                        echo array_key_exists($groupedby, $cal->grouped) ? $cal->grouped[$groupedby] : $cal->calc, $j;
                                        echo "</td>";
                                        echo  "</tr>";
}
$j++;
}                            ?>

</table></td>
                                        <td>7</td>


And result is on screen shot between standard fabrik calculation.

This what i need modify is code for "Test 2".

I have my custom calculation for all rows WHERE is query:
$query = "SELECT `is_pak_xxxx` FROM `ccjom_cc_kk_karta_rejestr` WHERE `rodzaj_karty_np_wzorzec`='2' ORDER BY `id`";

( this SELECT for $query add all rows that are preasent in my table 1)

i would like write query only for those rows/ the same rows as other standard fabrik calculations in my code.
How to write this?
How use option for rows filtering/SEARCH Table in my own code ???


I need write row selection for my calculation----Test-2 in fabrik:
inputbox -> fabrik-filter ------- need write "Order No, like: 15008" in field:
Nr zam. ---- {ccjom_cc_kk_karta_rejestr___zamow_symbol}
and use this selection to select rows in my calculations-Test2
how to code this $variable1 in my query SELECT ?


Now, for Order no = 15008 i get OK for standard fabrik calculations but for my Test2 show wrong - all rows in table1:
Code:
    Ilo?? kart: 22

2

Pakiety wej?? analogowych:
    Ana7800 ver 2.6: 22

3

AA:
    2 x (In/2In) + 2 x 3Un: 14
    3 x (In/50In) +Io: 8

4

AB:
    2 x (In/2In) + 2 x 3Un: 22

5

AC:
    3 x (In/50In) + Io: 8
    4 x 2Un: 14

6

AD:
    4 x 2 Un: 22

7
----- Test 1 --- Sum pakietow AA:
2 x (In/2In) + 2 x 3Un ------ 30
3 x (In/50In) +Io ------ 26

----- Test 2 ---- Sum pakietow AA, AB, AC, AD: -----
2 x (In/2In) + 2 x 3Un ------ 86
3 x (In/50In) +Io ------ 45
4 x 2Un ------ 86
3 x (In/50In) + X ------ 7

---- END TEST 1 and 2 ----

Pakiety przetwornika:
    ADCC HT ver 1.2: 22

8

Procesor:
    NXP3 1.6: 22

9

I found on fabrik forum this tip and code:
Fabrik table filter data is stored in this format in the session:

Code (Text):

[tablename___elementname{com_fabrik}{table}{79}] => data

but have problem how to use it in my query SELECT.
 

Attachments

  • Zaznaczenie_071.png
    Zaznaczenie_071.png
    43.4 KB · Views: 381
  • Zaznaczenie_072.png
    Zaznaczenie_072.png
    175.3 KB · Views: 408
Last edited:
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top