资源描述:
《iFix中采用ODBC制作报表》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、在iFix中采用ODBC制作历史报表胡俊上海海得控制系统公司系统网络部具体步骤如下:Step1:打开SCU中的TaskConfiguration,增加HTC.EXE和WSQLODC.EXE两个任务,并将它们设置成为后台运行状态;Step2:启动iFix,点击工具栏上的按钮打开HistoricalAssign,添加所需监控的数据点,并设置历史数据的采样速度。Step3:打开任务控制,查看是否已经启动HTC。上海海得控制系统股份有限公司系统网络部Page1电话:021-64401020传真:021-64401950Step4:在GlobalsUser下面添加三个字符型(vtS
2、tring)变量,分别命名为strStartTime,strEndTime和Interval。新建一幅画面,如图如示,在画面上布置3个DATALINK分别指向strStartTime,strEndTime和Interval,并设置成Inplace(即允许修改)。strStartTimestrEndTimeIntervalStep5:为画面上的各个按钮写代码,最好先将各按钮注册——即将鼠标移到按钮上方,按右键弹出菜单,选择EditScript。在VBEditor的工具菜单中的Reference(引用)中选中MicrosoftExcel9.0ObjectLibrary和Micr
3、osoftActiveXDataObjects,如下图所示。然后在各按钮的处理程序中添加相应代码。内容如下(可将下列代码直接COPY到你的VB编辑器中,覆盖因为注册产生的空代码):上海海得控制系统股份有限公司系统网络部Page1电话:021-64401020传真:021-64401950‘运行状态画面初始化PrivateSubCFixPicture_Initialize()CommandButton1_ClickCommandButton2_Clickuser.Interval.CurrentValue="00:00:30"EndSub‘组态状态画面初始化PrivateSu
4、bCFixPicture_InitializeConfigure()user.strEndTime.CurrentValue="报表结束时间"user.strStartTime.CurrentValue="报表开始时间"EndSub'设当前时间为报表开始时间PrivateSubCommandButton1_Click()DimcurTimeAsStringcurTime=NowDimcurmonth,curday,curhour,curminute,cursecondAsStringcurmonth=IIf(Month(curTime)<10,"0"&Month(curTi
5、me),Month(curTime))curday=IIf(Day(curTime)<10,"0"&Day(curTime),Day(curTime))curhour=IIf(Hour(curTime)<10,"0"&Hour(curTime),Hour(curTime))curminute=IIf(Minute(curTime)<10,"0"&Minute(curTime),Minute(curTime))cursecond=IIf(Second(curTime)<10,"0"&Second(curTime),Second(curTime))user.strStartTi
6、me.CurrentValue=Year(curTime)&"-"&curmonth&"-"&curday_&""&curhour&":"&curminute&":"&cursecondEndSub上海海得控制系统股份有限公司系统网络部Page1电话:021-64401020传真:021-64401950'设当前时间为报表结束时间PrivateSubCommandButton2_Click()DimcurTimeAsStringcurTime=NowDimcurmonth,curday,curhour,curminute,cursecondAsStringcurmonth=
7、IIf(Month(curTime)<10,"0"&Month(curTime),Month(curTime))curday=IIf(Day(curTime)<10,"0"&Day(curTime),Day(curTime))curhour=IIf(Hour(curTime)<10,"0"&Hour(curTime),Hour(curTime))curminute=IIf(Minute(curTime)<10,"0"&Minute(curTime),Minute(curTime))cursecond=IIf(Sec