Page 1 of 1

listcontrol

Posted: Thu Jun 19, 2014 5:12 am
by 16669478
I created the graph by converting the ActiveX Single Record

This is created by using ListControl, but, like using OLE DB, I would like to show up the data on a monitor with using While( xxxxx.MoveNext = S_OK)

I would like to know how to show up the data on ListControl based on dstAllRecords. Also, I would like to know how to embody insetlem and SetleemText at the source below.

Code: Select all

m_Adodc1.SetConnectionString("Provider=OraOLEDB.Oracle.1;Password=PMS123;Persist Security Info=True;User ID=PMS;Data Source=ORA11R;Extended Properties=\"\"");
	m_Adodc1.SetCommandType(1);

	CString SQL;
	CString m_search;
	CString strToday;  
     
	SYSTEMTIME    time;    
	::ZeroMemory(reinterpret_cast<void*>(&time), sizeof(time));     
 
	::GetLocalTime(&time);    
	strToday.Format (_T("%4d%02d%02d"), time.wYear ,time.wMonth ,time.wDay);
	
	GetDlgItem(IDC_DAY_INPUT)->GetWindowText(m_search);

	if( m_search == "" ){
		m_search = strToday;
	}else {
	}

	SQL.Format("SELECT TO_DATE(CONCAT(A.ACQSI_DT, MAX(A.ACQSI_HHMM)),'YYYYMMDDHH24MI') AS DATES, A.ACQSI_DT AS ACQSI_DT, MAX(A.ACQSI_HHMM) AS ACQSI_HHMM , A.HH AS HH, A.MM_TYPE AS MM_TYPE , SUM(A.CHRG_DCHG_VAL_KW) AS CHRG_DCHG_VAL_KW \
								FROM (																		 \
									SELECT  ACQSI_DT AS ACQSI_DT,											 \
											ACQSI_HHMM AS ACQSI_HHMM,										 \
											SUBSTR(ACQSI_HHMM,1,2) AS HH,									 \
											CASE WHEN SUBSTR(ACQSI_HHMM,3,2) BETWEEN '00' AND '14' THEN '1'  \
												 WHEN SUBSTR(ACQSI_HHMM,3,2) BETWEEN '15' AND '29' THEN '2'  \
												 WHEN SUBSTR(ACQSI_HHMM,3,2) BETWEEN '30' AND '44' THEN '3'  \
												 WHEN SUBSTR(ACQSI_HHMM,3,2) BETWEEN '45' AND '59' THEN '4'  \
												 END  AS  MM_TYPE,                                           \
												 CHRG_DCHG_VAL_KW AS CHRG_DCHG_VAL_KW                        \
									FROM PMS.EES_CHRG_DCHG_HIST	 WHERE ACQSI_DT = \
									'%s') A				 \
				GROUP BY  A.ACQSI_DT, A.HH, A.MM_TYPE	ORDER BY A.ACQSI_DT, A.HH, A.MM_TYPE", m_search);
										 
	m_Adodc1.SetRecordSource(SQL);
	m_Adodc1.Refresh();

	m_Chart1.Series(0).SetDatasourceType(dstAllRecords);
	m_Chart1.Series(0).SetDataSource((_variant_t)m_Adodc1.GetRecordset());
	
	m_list.InsertColumn(1, "취득일자", LVCFMT_CENTER, 100);
	m_list.InsertColumn(2, "시간타입", LVCFMT_CENTER, 100);
	

	m_Adodc1.GetRecordset().MoveFirst();

	int iCount = 0;

	CString str = m_Adodc1.GetRecordset().GetFields().GetItem(COleVariant("DATES")).GetValue();
	CString str1 = m_Adodc1.GetRecordset().GetFields().GetItem(COleVariant("ACQSI_DT")).GetValue();
	int iIndex = m_list.InsertItem(iCount, str, 0);
	m_list.SetItemText(iIndex, 1, str1);				

	return TRUE;  // return TRUE  unless you set the focus to a control
P.S. I have a favor to ask of any example if there is DataGrid used in TeeChart.

Re: listcontrol

Posted: Fri Jun 20, 2014 8:48 am
by yeray
Hello,

I'm not sure to understand what can we do at our side here.
You can access the series XValues and YValues arrays, can't you?
If you know how to populate a ListControl given an array of strings, you only should convert XValues and YValues arrays of doubles to arrays of strings and populate your ListControl as you'd do without TeeChart.