Hi,
Could somebody help me in this critical problem.
I've create a reports using Crystal Report's Active Data and Field Definition file (.ttx).
This consept working fine with Crystal 8.5, but not 11.5 any more. In version 11.5 database fields of report (through .ttx defined) are empties.
Export, print and preview working, but not include any field of values in detaljs rows.
Formula and Parameter fields occurs in report correct.
What's wrong in my below code?
.rpt not include any subreport, only one simple detalj row.
#import "C:\Program Files\Business Objects\Common\3.5\bin\craxdrt.dll" no_namespace rename("FindText", "CRFindText")
#import "C:\Program Files\Business Objects\Common\3.5\crystalreportviewers115\ActiveXControls\crviewer.dll" named_guids raw_native_types no_namespace
....
IApplicationPtr m_CRApplication;
IReportPtr m_CRReport;
IDatabasePtr m_reportdb;
IDatabaseTablesPtr m_reporttables;
IDatabaseTablePtr m_reporttable;
...
m_CRApplication.CreateInstance("CrystalRuntime.application.11")
long il = 0;
_variant_t va(il, VT_I4);
m_CRReport = m_CRApplication->OpenReport(myRptFilePath, va);
m_reportdb = m_CRReport->Database;
m_reporttables = m_reportdb->Tables;
m_reporttable = m_reporttables->Item[(long)1];
IDatabaseFieldDefinitionsPtr defs;
IDatabaseFieldDefinitionPtr fielddef;
_bstr_t btFldName;
int iType;
defs = m_reporttable->Fields;
int iDefsFieldCount = defs->Count;
long iFld=0; for(iFld=1; iFld<=iDefsFieldCount; iFld++)
{
fielddef = defs->Item[iFld];
btFldName = fielddef->DatabaseFieldName;
iType = fielddef->GetValueType();
int j=0; for(j=0;j<m_fieldcount;j++)
{
if(!_strcmpi(m_fieldnames[j], btFldName))
{
m_fieldmap.insert(string2intmap::value_type(iFld-1, j));
break;
}
}
}
CComPtr<ICRDataSource> CRdatasource;
QueryInterface(IID_ICRDataSource, (void**)&CRdatasource);
_variant_t vr(CRdatasource);
m_reporttable->SetPrivateData(3,vr);
m_CRReport->Export(true);
..........
My IDL - ICRDataSource automation interface is:
[
uuid(F4ED51D0-E0D5-11D1-92B3-00A0C92765B4),
helpstring("ICRDataSource Interface")
]
interface ICRDataSource : IUnknown {
[propget, helpstring("property FieldCount")]
HRESULT _stdcall FieldCount([out, retval] short* pVal);
[propget, helpstring("property RecordCount")]
HRESULT _stdcall RecordCount([out, retval] long* pVal);
[propget, helpstring("property FieldName")]
HRESULT _stdcall FieldName(
short FieldIndex,
[out, retval] BSTR* pVal);
[propget, helpstring("property FieldType")]
HRESULT _stdcall FieldType(
short FieldIndex,
[out, retval] short* pVal);
[propget, helpstring("property FieldValue")]
HRESULT _stdcall FieldValue(
short FieldIndex,
[out, retval] VARIANT* pVal);
[helpstring("method MoveFirst")]
HRESULT _stdcall MoveFirst();
[helpstring("method MoveNext")]
HRESULT _stdcall MoveNext();
[propget, helpstring("property Bookmark")]
HRESULT _stdcall Bookmark([out, retval] VARIANT* pVal);
[propput, helpstring("property Bookmark")]
HRESULT _stdcall Bookmark([in] VARIANT pVal);
[propget, helpstring("property Eof")]
HRESULT _stdcall Eof([out, retval] VARIANT_BOOL* pVal);
};
Could somebody help me in this critical problem.
I've create a reports using Crystal Report's Active Data and Field Definition file (.ttx).
This consept working fine with Crystal 8.5, but not 11.5 any more. In version 11.5 database fields of report (through .ttx defined) are empties.
Export, print and preview working, but not include any field of values in detaljs rows.
Formula and Parameter fields occurs in report correct.
What's wrong in my below code?
.rpt not include any subreport, only one simple detalj row.
#import "C:\Program Files\Business Objects\Common\3.5\bin\craxdrt.dll" no_namespace rename("FindText", "CRFindText")
#import "C:\Program Files\Business Objects\Common\3.5\crystalreportviewers115\ActiveXControls\crviewer.dll" named_guids raw_native_types no_namespace
....
IApplicationPtr m_CRApplication;
IReportPtr m_CRReport;
IDatabasePtr m_reportdb;
IDatabaseTablesPtr m_reporttables;
IDatabaseTablePtr m_reporttable;
...
m_CRApplication.CreateInstance("CrystalRuntime.application.11")
long il = 0;
_variant_t va(il, VT_I4);
m_CRReport = m_CRApplication->OpenReport(myRptFilePath, va);
m_reportdb = m_CRReport->Database;
m_reporttables = m_reportdb->Tables;
m_reporttable = m_reporttables->Item[(long)1];
IDatabaseFieldDefinitionsPtr defs;
IDatabaseFieldDefinitionPtr fielddef;
_bstr_t btFldName;
int iType;
defs = m_reporttable->Fields;
int iDefsFieldCount = defs->Count;
long iFld=0; for(iFld=1; iFld<=iDefsFieldCount; iFld++)
{
fielddef = defs->Item[iFld];
btFldName = fielddef->DatabaseFieldName;
iType = fielddef->GetValueType();
int j=0; for(j=0;j<m_fieldcount;j++)
{
if(!_strcmpi(m_fieldnames[j], btFldName))
{
m_fieldmap.insert(string2intmap::value_type(iFld-1, j));
break;
}
}
}
CComPtr<ICRDataSource> CRdatasource;
QueryInterface(IID_ICRDataSource, (void**)&CRdatasource);
_variant_t vr(CRdatasource);
m_reporttable->SetPrivateData(3,vr);
m_CRReport->Export(true);
..........
My IDL - ICRDataSource automation interface is:
[
uuid(F4ED51D0-E0D5-11D1-92B3-00A0C92765B4),
helpstring("ICRDataSource Interface")
]
interface ICRDataSource : IUnknown {
[propget, helpstring("property FieldCount")]
HRESULT _stdcall FieldCount([out, retval] short* pVal);
[propget, helpstring("property RecordCount")]
HRESULT _stdcall RecordCount([out, retval] long* pVal);
[propget, helpstring("property FieldName")]
HRESULT _stdcall FieldName(
short FieldIndex,
[out, retval] BSTR* pVal);
[propget, helpstring("property FieldType")]
HRESULT _stdcall FieldType(
short FieldIndex,
[out, retval] short* pVal);
[propget, helpstring("property FieldValue")]
HRESULT _stdcall FieldValue(
short FieldIndex,
[out, retval] VARIANT* pVal);
[helpstring("method MoveFirst")]
HRESULT _stdcall MoveFirst();
[helpstring("method MoveNext")]
HRESULT _stdcall MoveNext();
[propget, helpstring("property Bookmark")]
HRESULT _stdcall Bookmark([out, retval] VARIANT* pVal);
[propput, helpstring("property Bookmark")]
HRESULT _stdcall Bookmark([in] VARIANT pVal);
[propget, helpstring("property Eof")]
HRESULT _stdcall Eof([out, retval] VARIANT_BOOL* pVal);
};