Data not displaying while using open connector in scheduler

Hello,

I am using open connector for fetching the resource name in y axis of timeline through stored procedure , but is not coming.

I am using below code for connector

[code]package com;
import java.sql.Connection;
import java.sql.DriverManager;

import org.apache.catalina.connector.Request;

import com.dhtmlx.connector.ConnectorBehavior;
import com.dhtmlx.connector.ConnectorServlet;
import com.dhtmlx.connector.DBType;
import com.dhtmlx.connector.DataItem;
import com.dhtmlx.connector.JSONSchedulerConnector;
import com.dhtmlx.connector.OptionsConnector;
import com.dhtmlx.connector.SchedulerConnector;

public class Myconnector extends ConnectorServlet{

@Override
protected void configure() {
	  //obtain DB connection
	try {
	Connection conn=null;
    
 //    Class.forName ("org.postgresql.Driver").newInstance ();
 Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance ();

    conn = DriverManager.getConnection("jdbc:sqlserver://SPC102:1433;user=sa;password=crmit@123;database=EMM_Portal_Test");
    //Initialize connector
      SchedulerConnector c = new SchedulerConnector(conn, DBType.MSSQL);
      OptionsConnector oc=     new OptionsConnector(conn, DBType.MSSQL);
  
      oc.render_complex_sql("exec usp_Schedule_FetchAll_Test 123456,1,1,'Week','19 JUL 2016','15,16','NormalShiftCrossTab','rank',0", "value", "value,label");

    c.set_options("sections", oc);
    c.render_complex_sql("exec usp_Schedule_FetchAll_Test 123456,1,1,'Week','19 JUL 2016','15,16','ScheduleList','rank',0", "scheduleId", "MarkingDateStart,MarkingDateEnd,PreferredMarkingQueueShortName,MarkerName");
}
 catch (Throwable e) {
    e.printStackTrace();
}

}

}
[/code]

my jsp page is like below

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<%-- <script type="text/javascript" charset="utf-8" src='<s:url value="./js/dhtmlxscheduler.js"/>'></script> --%>
<script type="text/javascript" charset="utf-8" src="./codebase/dhtmlxscheduler.js"></script>
<link rel="stylesheet" href="./codebase/dhtmlxscheduler.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="./codebase/ext/dhtmlxscheduler_limit.js" type="text/javascript" charset="utf-8"></script>
<%-- <script src="./codebase/ext/dhtmlxscheduler_dhx_terrace.js" type="text/javascript" charset="utf-8"></script> --%>
<script src="./codebase/ext/dhtmlxscheduler_minical.js" type="text/javascript" charset="utf-8"></script>
<script src="./codebase/ext/dhtmlxscheduler_timeline.js" type="text/javascript" charset="utf-8"></script>

<!-- for ajax call for sections -->
<script src="http://code.jquery.com/jquery-latest.min.js"></script>

<style media="screen">
	html, body{
		margin:0px;
		padding:0px;
		height:100%;
		overflow:hidden;
	}

	.dhx_cal_event {
		z-index: 1;
		cursor: pointer;
	}
	.highlighted_timespan {
		
		opacity:0.5;
		filter:alpha(opacity=50);
		cursor: pointer;
		z-index: 0;
	}
</style>
<script charset="utf-8">
function init() {
	

	scheduler.config.xml_date="%Y-%m-%d %H:%i";
	
	scheduler.createTimelineView({
		name:	"timeline",
		x_unit:	"minute",
		x_date:	"%H:%i",
		x_step:	30,
		x_size: 12,
		x_start: 16,
		x_length:	48,
		y_unit:scheduler.serverList("sections"),
	   y_property:	"value",
		render:"bar"
	});


	scheduler.init("scheduler_here",new Date(2016,07,18),"timeline");

    scheduler.load("myconnector.do?uid="+scheduler.uid());
    
    var dp = new dataProcessor("myconnector.do");
	dp.init(scheduler); 
	

}


function setScaleHeight(){
	  if (dayScale != 0){
	    scheduler.xy.scale_height;
	  } else {
	    scheduler.xy.scale_height = scheduler.xy.scale_height*2;
	  }
	  dayScale = 1; 
	}

	var func = function(e) {
		//alert("hrello");
	  e = e || window.event;
	  var el = e.target || e.srcElement;
	  var value = el.value;
	  updateTimeline(value);
	  
	 
	};


function loadOptions(){
	
	scheduler.load("myconnector.do?uid="+scheduler.uid());
}

var dayScale;
function updateTimeline(value){
		//alert('hello');
  var timeline = scheduler.matrix.timeline; 
  switch (value) {
    case "1":
      timeline.x_unit =	"minute";
      timeline.x_date =	"%H:%i";     
    // timeline.x_date =	"%h:%i:%s";
      scheduler.templates.timeline_scale_date = function(date){
         var func=scheduler.date.date_to_str(timeline.x_date);
         return func(date);
      };
      timeline.x_step =	30;
      timeline.x_size = 24;
      timeline.x_start = 16;
      timeline.x_length = 48;
            
      timeline.second_scale = false;       
            
      if (dayScale != 0){
      	scheduler.xy.scale_height = scheduler.xy.scale_height/2;
      	dayScale = 0;
      } else {
        scheduler.xy.scale_height;
      };
      scheduler.setCurrentView();      
      break; 
      
    case "2":          
      timeline.x_unit =	"day";
      timeline.x_date =	"%j %D";
     //timeline.x_date =	"%Y-%m-%d";
      scheduler.templates.timeline_scale_date = function(date){
         var func=scheduler.date.date_to_str(timeline.x_date);
         return func(date);
      };
      timeline.x_step =	1;
      timeline.x_size = 7;
      timeline.x_start = 0;
      timeline.x_length = 7; 
      scheduler.templates.timeline_second_scalex_class = function(date){
    	    return "";
    	};       
    /*  timeline.second_scale = {
        x_unit:"week",
        x_date: "Week %W"
      }; */   
      setScaleHeight(dayScale);         
      scheduler.setCurrentView();      
      break;
      
    case "3":	    
      timeline.x_unit =	"day";
      timeline.x_date =	"%j";  
      //timeline.x_date =	"%Y-%m-%d"; 
      scheduler.templates.timeline_scale_date = function(date){
         var func=scheduler.date.date_to_str(timeline.x_date);
         return func(date);
      };
      timeline.x_step =	1;
      timeline.x_size = 30;
      timeline.x_start = 0;
      timeline.x_length = 30;
                  
      timeline.second_scale = {
        x_unit:"month",
        x_date: "%F"
      };
      scheduler.templates.timeline_second_scale_date = function(date){
      var func = scheduler.date.date_to_str(timeline.second_scale.x_date);
          return func(date);
      };      
      setScaleHeight(dayScale);      
      scheduler.setCurrentView();
      break;
      
    case "4":
      timeline.x_unit =	"month";
      timeline.x_date =	"%F";  
      scheduler.templates.timeline_scale_date = function(date){
         var func=scheduler.date.date_to_str(timeline.x_date);
         return func(date);
      };
      timeline.x_step =	1;
      timeline.x_size = 12;
      timeline.x_start = 0;
      timeline.x_length = 12; 
                  
      timeline.second_scale = {
        x_unit:"year",
        x_date: "%Y"
      };
      scheduler.templates.timeline_second_scale_date = function(date){
      var func = scheduler.date.date_to_str(timeline.second_scale.x_date);
          return func(date);
      };      
      setScaleHeight();       
      scheduler.setCurrentView();    
      break;
  }
}

function tempday(){
	  
	  updateTimeline('1');
	  
}

function tempWeek(){
	  
	  updateTimeline('2');
	  
}

function tempMonth(){
	  
	  updateTimeline('3');
	  
}

</script>
</head>
<body onload="init();">

<div id="scheduler_here" class="dhx_cal_container" style="width:100%; height:100%;">
	<div class="dhx_cal_navline">
		<div class="dhx_cal_prev_button">&nbsp;</div>
		<div class="dhx_cal_next_button">&nbsp;</div>
		<div class="dhx_cal_today_button"></div>
		<div class="dhx_cal_date"></div>
		<div  name="day_tab"  onclick="tempday();" style="right:204px;"></div>
		<div class="" name="week_tab" onclick="tempWeek();"style="right:140px;"></div>
		<div class="" name="month_tab" onclick="tempMonth(); " style="right:76px;"></div>
		<div class="dhx_cal_tab" name="timeline_tab" "style="right:76px;"></div>
		<!-- <div ><input type="button" value ="Load options" onclick="loadOptions()"></div> --> 
		
	</div>
	<div class="dhx_cal_header">
	</div>
	<div class="dhx_cal_data">
	</div>
</div>

</body>
</html>


Don’t know I using the open connector in correct way or not ? whatever the document I think I using in that way only . Please suggest where I a am missing?

Hi,

The code looks fine. Can you post the XML data generated by connector?
( you can open “myconnector.do” directly in a browser and post the output here )

Hello Stanislav,

Thanks for your quick response, actually column name label and value was not coming as result set from stored procedure , that’s why the resources
were not populating . I have fix that one now , the resources and event both xml I am getting and resources are displaying in axis but the events are not displaying against resources. I am attaching both the xmls below .

<event id='1470828130018_0' ><start_date><![CDATA[2016-07-18 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-18 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 997215]]></MarkerName></event> <event id='1470828141105_1' ><start_date><![CDATA[2016-07-18 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-18 23:00:00.0]]></end_date><text><![CDATA[W1]]></text><MarkerName><![CDATA[Marker 995029]]></MarkerName></event> <event id='1470828165071_2' ><start_date><![CDATA[2016-07-18 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-18 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 994014]]></MarkerName></event> <event id='1470828167359_3' ><start_date><![CDATA[2016-07-18 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-18 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 994309]]></MarkerName></event> <event id='1470828169293_4' ><start_date><![CDATA[2016-07-18 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-18 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 51232]]></MarkerName></event> <event id='1470828170516_5' ><start_date><![CDATA[2016-07-18 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-18 23:00:00.0]]></end_date><text><![CDATA[W1]]></text><MarkerName><![CDATA[Marker 992501]]></MarkerName></event> <event id='1470828171655_6' ><start_date><![CDATA[2016-07-18 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-18 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 20388]]></MarkerName></event> <event id='1470828174879_7' ><start_date><![CDATA[2016-07-19 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-19 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 997215]]></MarkerName></event> <event id='1470828174891_8' ><start_date><![CDATA[2016-07-19 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-19 23:00:00.0]]></end_date><text><![CDATA[W1]]></text><MarkerName><![CDATA[Marker 995029]]></MarkerName></event> <event id='1470828174897_9' ><start_date><![CDATA[2016-07-19 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-19 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 994014]]></MarkerName></event> <event id='1470828174899_10' ><start_date><![CDATA[2016-07-19 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-19 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 994309]]></MarkerName></event> <event id='1470828174902_11' ><start_date><![CDATA[2016-07-19 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-19 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 51232]]></MarkerName></event> <event id='1470828174905_12' ><start_date><![CDATA[2016-07-19 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-19 23:00:00.0]]></end_date><text><![CDATA[W1]]></text><MarkerName><![CDATA[Marker 992501]]></MarkerName></event> <event id='1470828174907_13' ><start_date><![CDATA[2016-07-19 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-19 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 20388]]></MarkerName></event> <event id='1470828174909_14' ><start_date><![CDATA[2016-07-20 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-20 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 997215]]></MarkerName></event> <event id='1470828174910_15' ><start_date><![CDATA[2016-07-20 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-20 23:00:00.0]]></end_date><text><![CDATA[W1]]></text><MarkerName><![CDATA[Marker 995029]]></MarkerName></event> <event id='1470828174911_16' ><start_date><![CDATA[2016-07-20 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-20 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 994014]]></MarkerName></event> <event id='1470828174912_17' ><start_date><![CDATA[2016-07-20 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-20 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 994309]]></MarkerName></event> <event id='1470828174913_18' ><start_date><![CDATA[2016-07-20 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-20 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 51232]]></MarkerName></event> <event id='1470828174915_19' ><start_date><![CDATA[2016-07-20 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-20 23:00:00.0]]></end_date><text><![CDATA[W1]]></text><MarkerName><![CDATA[Marker 992501]]></MarkerName></event> <event id='1470828174916_20' ><start_date><![CDATA[2016-07-20 07:00:00.0]]></start_date><end_date><![CDATA[2016-07-20 23:00:00.0]]></end_date><text><![CDATA[W2]]></text><MarkerName><![CDATA[Marker 20388]]></MarkerName></event>

for Resources xml is

<item value='Marker 997215' label='Marker 997215'></item> <item value='Marker 995029' label='Marker 995029'></item> <item value='Marker 994014' label='Marker 994014'></item> <item value='Marker 994309' label='Marker 994309'></item> <item value='Marker 51232' label='Marker 51232'></item> <item value='Marker 992501' label='Marker 992501'></item> <item value='Marker 20388' label='Marker 20388'></item>

Please suggest where I am mistaking?

Change in createTimelineView command

  y_property:   "value",

to

  y_property:   "MarkerName",

That is the name of property, by which events will be grouped