<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic infoTemplate content - relationshipQuery in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/infotemplate-content-relationshipquery/m-p/165830#M15386</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm struggling trying to construct a relationshipQuery that populates an infoTemplate&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
var template = new esri.InfoTemplate();
template.setTitle("${site_code} - ${facil_loca}");
template.setContent(getWindowContent);
&amp;nbsp; 
map.infoWindow.resize(250,250);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
var facils = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/0",{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
 infoTemplate:template,
 id: 'facils',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields:["*"]
});&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;on feature click, getWindowContent() is fired, which constructs the infowindow dijit.layout's&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
function getWindowContent(graphic){
 //make a tab container 
 var infoTabCont = new dijit.layout.TabContainer({
&amp;nbsp; style: "width: 100%;height:100%;background-color:transparent;"
 }, dojo.create("div"));
&amp;nbsp; 
 //display attribute info in first tab
 var cp1 = new dijit.layout.ContentPane({
&amp;nbsp; style: "background-color:transparent;color:White;",
&amp;nbsp; title: "Details",
&amp;nbsp; content: "FacID: " + graphic.attributes.site_code + "&amp;lt;br /&amp;gt; Fac Name: " + graphic.attributes.facil_name
 })
&amp;nbsp; 
 //create 2nd tab for related info
 var cp2 = new dijit.layout.ContentPane({
&amp;nbsp; style: "background-color:transparent;color:White;",
&amp;nbsp; title: "Cmd Structure",
&amp;nbsp; content: getRelatedData(graphic) //this is the problem &amp;lt;-----------
 })
&amp;nbsp; 
 //add the content panes to the tab container
 infoTabCont.addChild(cp1);
 infoTabCont.addChild(cp2);
 return infoTabCont.domNode;
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the content for the second tab fires getRelatedData(), which *should* construct a relationshipQuery and return related data to populate the infowindow tab&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
function getRelatedData(graphicObj){&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 var objid = graphicObj.attributes.OBJECTID_1
 var relatedFacMain = new esri.tasks.RelationshipQuery();
 relatedFacMain.outFields = ["*"];
 relatedFacMain.relationshipId = 0;
 relatedFacMain.objectIds = [objid];
 graphicObj.queryRelatedFeatures(relatedFacMain, function(relatedRecords) {
&amp;nbsp; console.log(relatedRecords)
 })
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;on feature click, I get the following warning in firebug: "graphicObj.queryRelatedFeatures is not a function"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I know all the parameters for the relationshipquery are correct, I plugged them into the relationshipquery sample and it works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Apr 2012 14:18:44 GMT</pubDate>
    <dc:creator>danbecker</dc:creator>
    <dc:date>2012-04-10T14:18:44Z</dc:date>
    <item>
      <title>infoTemplate content - relationshipQuery</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/infotemplate-content-relationshipquery/m-p/165830#M15386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm struggling trying to construct a relationshipQuery that populates an infoTemplate&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
var template = new esri.InfoTemplate();
template.setTitle("${site_code} - ${facil_loca}");
template.setContent(getWindowContent);
&amp;nbsp; 
map.infoWindow.resize(250,250);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
var facils = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/0",{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
 infoTemplate:template,
 id: 'facils',
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields:["*"]
});&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;on feature click, getWindowContent() is fired, which constructs the infowindow dijit.layout's&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
function getWindowContent(graphic){
 //make a tab container 
 var infoTabCont = new dijit.layout.TabContainer({
&amp;nbsp; style: "width: 100%;height:100%;background-color:transparent;"
 }, dojo.create("div"));
&amp;nbsp; 
 //display attribute info in first tab
 var cp1 = new dijit.layout.ContentPane({
&amp;nbsp; style: "background-color:transparent;color:White;",
&amp;nbsp; title: "Details",
&amp;nbsp; content: "FacID: " + graphic.attributes.site_code + "&amp;lt;br /&amp;gt; Fac Name: " + graphic.attributes.facil_name
 })
&amp;nbsp; 
 //create 2nd tab for related info
 var cp2 = new dijit.layout.ContentPane({
&amp;nbsp; style: "background-color:transparent;color:White;",
&amp;nbsp; title: "Cmd Structure",
&amp;nbsp; content: getRelatedData(graphic) //this is the problem &amp;lt;-----------
 })
&amp;nbsp; 
 //add the content panes to the tab container
 infoTabCont.addChild(cp1);
 infoTabCont.addChild(cp2);
 return infoTabCont.domNode;
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the content for the second tab fires getRelatedData(), which *should* construct a relationshipQuery and return related data to populate the infowindow tab&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
function getRelatedData(graphicObj){&amp;nbsp;&amp;nbsp;&amp;nbsp; 
 var objid = graphicObj.attributes.OBJECTID_1
 var relatedFacMain = new esri.tasks.RelationshipQuery();
 relatedFacMain.outFields = ["*"];
 relatedFacMain.relationshipId = 0;
 relatedFacMain.objectIds = [objid];
 graphicObj.queryRelatedFeatures(relatedFacMain, function(relatedRecords) {
&amp;nbsp; console.log(relatedRecords)
 })
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;on feature click, I get the following warning in firebug: "graphicObj.queryRelatedFeatures is not a function"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I know all the parameters for the relationshipquery are correct, I plugged them into the relationshipquery sample and it works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 14:18:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/infotemplate-content-relationshipquery/m-p/165830#M15386</guid>
      <dc:creator>danbecker</dc:creator>
      <dc:date>2012-04-10T14:18:44Z</dc:date>
    </item>
  </channel>
</rss>

