Placeholders not working in calc field as child element of a copied group item

thaGH05T

New Member
Hello All,

Basic Setup:
I have created a list and a from that list (list 1) and copied that to a new list (list 2) and removed most of the child elements of list 2 because it is used for a Google map visualization and the load time seems to be a bit faster this way. In list 2 i have an element called 'status' who's type is calc. I have PHP code that will return an image tag that is used by the Google map visualization in that status field. the child element is still linked to the parent and has the exact same code.

Problem:
When list 1 is displayed the PHP code for the status field work without issues, but when I display the Google map visualization the status field does not display the correct image tag. When I debugged the code and did a var dump of each variable I was surprised to find that they seem to be unset. The variables that I am using are defined from placeholders.

Calc Field (status):
Code:
$nodeType = '{Solarwinds___NodeType}';
$statusLED = '{Solarwinds___StatusLED}';
$siteCode = "{sp_NA___code}";



$db=JFactory::getDbo();

$query1=$db->getQuery(true);
$query1->select('s.NodeType as nodeType, s.StatusLED as statusLED, s.Site_Code as site_Code')
      ->from('Solarwinds as s')
      ->where('site_Code = "' . $siteCode . '"')
          ->where('nodeType = "Internet"');
$db->setQuery($query1);
$array = $db->loadAssocList();

$results = array_shift($array);

$inet = $results['statusLED'];

//return $inet;

$query2=$db->getQuery(true);
$query2->select('s.NodeType as nodeType, s.StatusLED as statusLED, s.Site_Code as site_Code')
        ->from('Solarwinds as s')
            ->where('site_Code = "' . $siteCode . '"')
            ->where('nodeType = "MPLS"');
$db->setQuery($query2);
$array = $db->loadAssocList();

$results = array_shift($array);

$mpls = $results['statusLED'];

//return $mpls;

$query3=$db->getQuery(true);
$query3->select('s.NodeType as nodeType, s.StatusLED as statusLED, s.Site_Code as site_Code')
      ->from('Solarwinds as s')
            ->where('site_Code = "' . $siteCode . '"')
            ->where('nodeType = "Routers"');
$db->setQuery($query3);
$array = $db->loadAssocList();

$results = array_shift($array);

$routers = $results['statusLED'];

//return $routers;

if ($mpls AND $inet) {
  if ($mpls === "Up.gif" AND $inet === "Up.gif") {
    $status = '<img src="/images/icons/up.gif" alt="" />';
  } elseif ($mpls === "Down.gif" AND $inet === "Down.gif") {
    $status = '<img src="/images/icons/bdown.gif" alt="" />';
  } else {
    $status = '<img src="/images/icons/fwarn.gif" alt="" />';
  }
} elseif (!$mpls AND $inet) {
    if ($inet === "Up.gif") {
    $status = '<img src="/images/icons/up.gif" alt="" />';
  } elseif ($inet === "Down.gif") {
    $status = '<img src="/images/icons/bdown.gif" alt="" />';
  } else {
    $status = '<img src="/images/icons/fwarn.gif" alt="" />';
  }
} elseif (!$inet AND $mpls) {
    if ($mpls === "Up.gif") {
    $status = '<img src="/images/icons/up.gif" alt="" />';
  } elseif ($mpls === "Down.gif") {
    $status = '<img src="/images/icons/bdown.gif" alt="" />';
  } else {
    $status = '<img src="/images/icons/fwarn.gif" alt="" />';
  }
} elseif ($routers) {
    if ($routers === "Up.gif") {
        $status = '<img src="/images/icons/up.gif" alt="" />';
    } elseif ($routers === "Down.gif") {
        $status = '<img src="/images/icons/bdown.gif" alt="" />';
    } else {
        $status = '<img src="/images/icons/not.gif" alt="" />';
    }
} else {
  $status = '<img src="/images/icons/not.gif" alt="" />';
}

/*Debugging
var_dump($nodeType);
print "<-- Node Type ";
var_dump($statusLED);
print "<-- Status LED ";
var_dump($siteCode);
print "<-- Site Code ";
*/
return $status;

Basically I am getting the ELSE value when the visualization loads. The visualization points to list 2 and uses the status filed as the marker image. Again, the same code from above works without a hitch in the list 1 list. I should also mention that I do not have this problem with my dev site, which is actually working. The dev site was backed up and replicated to the prod site and the prod site is the one having the issues at this point. I should also mention that this same code worked before without issues on the prod site before the migration.

Things I Have Done:
  • I have migrated the site 3 times just to be sure.
  • I have unlinked the child elements from the parent elements.
  • I have created a new Google Map visualization to test with.
  • I have reinstalled the calc field plugin.

What I K now:
The placeholders are returning nothing at all when the child element from list 2 is chosen as the marker image. The placeholders return their values when the visualization is pointed to list 1's calc element and displays the correct markers.

What I Need Help With:
  • Understanding why this is happening.
  • Getting the child calc element to actually see the placeholders.
  • Optimizing map load times. <--- Not relevant really.
  • Develop better debugging skills with Fabrik.
 
$nodeType = '{Solarwinds___NodeType}';
$statusLED = '{Solarwinds___StatusLED}';
$siteCode = "{sp_NA___code}";

The above are elements from the main table (list 1) and the joined table on list 1. The calc field uses these values in list 1 and so does the calc field in list 2 which is a copy of list 1. Although, if I look in the elements list both calc fields have the same reference, "sp_NA___status" with this being the case shouldn't I be able to access it all the same using placeholders? Again, I want to stress the exact same setup works on my dev site. This also worked before my last push from dev to prod.

Question: Are all elements in the elements list accessible by using placeholders?
 
If you copy a list, elements have the same name, but are not the same (id is different)
So, in your list2_calcelement, you have access to list2 elements, but not list1 elements
 
If that is the case, then how in the world does my dev site work? And also, if I never unlink the elements the PHP code would be the same for both calc elements, wouldn't that mean it should not work? I thought the purpose of linked elements and duplicating groups was to be able to do things such as this? Keeping the data the same while accessing smaller amounts of it, and any changes to the parent item was changed for the child as well making all data and datatypes synonymous.
 
This is something I'd have to get hands-on to figure out, which I can't really do in Community support.

-- hugh
 
Again, I want to stress the exact same setup works on my dev site. This also worked before my last push from dev to prod.
How did you "push"?
Is your (prod) Fabrik connection pointing to the correct database?
 
I'm more than willing to pay for support, but this is an intranet site and I cannot provide access to it.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top