//
定义
XmlDataSet: TClientDataSet;
XmlTrans: TXMLTransform;
// 数据读取
XmlTrans: = TXMLTransform.Create(self);
XmlTrans.SourceXmlFile: = ExtractFilePath(Application.ExeName) + ' report.xml ' ;
XmlTrans.TransformationFile: = ExtractFilePath(Application.ExeName) + ' report.xtr ' ; // 用xml mapper工具根据xml文件生成的文件
XmlDataSet: = TClientDataSet.Create(self);
XmlDataSet.XMLData: = XmlTrans.Data;
XmlDataSet.IndexDefs.Add( ' noasc ' , ' no ' ,[ixPrimary]);
XmlDataSet.IndexDefs.Add( ' lastpricedesc ' , ' lastprice ' ,[ixDescending]);
// Filter过滤
XmlDataSet.Filter: = ' bargainflag=1 and lasttype=0 ' ;
XmlDataSet.Filtered: = true ;
if self.RzRadioButtonLastprice.Checked then
XmlDataSet.IndexName: = ' lastpricedesc '
else
XmlDataSet.IndexName: = ' noasc ' ;
// 取记录值
XmlDataSet.RecNo: = frxUserDataSet4.RecNo + 1 ;
Value: = XmlDataSet.FieldByName(FieldName).AsString;
XmlDataSet: TClientDataSet;
XmlTrans: TXMLTransform;
// 数据读取
XmlTrans: = TXMLTransform.Create(self);
XmlTrans.SourceXmlFile: = ExtractFilePath(Application.ExeName) + ' report.xml ' ;
XmlTrans.TransformationFile: = ExtractFilePath(Application.ExeName) + ' report.xtr ' ; // 用xml mapper工具根据xml文件生成的文件
XmlDataSet: = TClientDataSet.Create(self);
XmlDataSet.XMLData: = XmlTrans.Data;
XmlDataSet.IndexDefs.Add( ' noasc ' , ' no ' ,[ixPrimary]);
XmlDataSet.IndexDefs.Add( ' lastpricedesc ' , ' lastprice ' ,[ixDescending]);
// Filter过滤
XmlDataSet.Filter: = ' bargainflag=1 and lasttype=0 ' ;
XmlDataSet.Filtered: = true ;
if self.RzRadioButtonLastprice.Checked then
XmlDataSet.IndexName: = ' lastpricedesc '
else
XmlDataSet.IndexName: = ' noasc ' ;
// 取记录值
XmlDataSet.RecNo: = frxUserDataSet4.RecNo + 1 ;
Value: = XmlDataSet.FieldByName(FieldName).AsString;
本文转自 OldHawk 博客园博客,原文链接:http://www.cnblogs.com/taobataoma/archive/2007/06/12/780939.html
,如需转载请自行联系原作者