码迷,mamicode.com
首页 > 其他好文 > 详细

用临时表作lookup数据源

时间:2019-06-09 13:04:36      阅读:136      评论:0      收藏:0      [点我收藏+]

标签:rms   sel   str   ddd   string   count   ram   cost   line   

public static void lookupRate(FormStringControl _contrl,
TNK_ToRisk_C _custAccount,
TNK_LTSeiZhaCh_COCTR_C _costCenter,
TNK_SB_C _itemId)
{
SysTableLookup sysTableLookup;
Query q;
QueryBuildDataSource qbds;
TNK_BaseRate_C baseRate_C;
TNK_RDB_JIGSOBA_UNT_SBT unt_SBT;
TNK_TmpCustomerRate tmpCustomerRate;
delete_from tmpCustomerRate;
ttsBegin;
insert_recordset tmpCustomerRate
(JIGSOBA_UNT_SBT, SCBaseRate_C, LTSeiZhaCh_COCTR_C, ToRisk_C, SB_C)
select BaseRate_C, SCBaseRate_C, LTSeiZhaCh_COCTR_C, ToRisk_C, _itemId from baseRate_C
where baseRate_C.ToRisk_C == _custAccount
&& baseRate_C.LTSeiZhaCh_COCTR_C == _costCenter
&& baseRate_C.SCBaseRate_C // 特殊汇率
&& baseRate_C.SYOUNINN_F // 已批准
exists join unt_SBT
where unt_SBT.JIGSOBA_UNT_SBT == baseRate_C.BaseRate_C
&& unt_SBT.SB_C == _itemId;
if(!tmpCustomerRate)
{
insert_recordset tmpCustomerRate
(JIGSOBA_UNT_SBT, SCBaseRate_C, LTSeiZhaCh_COCTR_C, ToRisk_C, SB_C)
select BaseRate_C, SCBaseRate_C, LTSeiZhaCh_COCTR_C, ToRisk_C, _itemId from baseRate_C
where baseRate_C.ToRisk_C == _custAccount
&& baseRate_C.LTSeiZhaCh_COCTR_C == _costCenter
&& !baseRate_C.SCBaseRate_C // 非特殊汇率
exists join unt_SBT
where unt_SBT.JIGSOBA_UNT_SBT == baseRate_C.BaseRate_C
&& unt_SBT.SB_C == _itemId;
}
ttsCommit;
select tmpCustomerRate;
q = new Query();
qbds = q.addDataSource(tableNum(TNK_TmpCustomerRate));
sysTableLookup = SysTableLookup::newParameters(tableNum(TNK_TmpCustomerRate), _contrl);
sysTableLookup.addLookupfield(fieldNum(TNK_TmpCustomerRate, JIGSOBA_UNT_SBT));
sysTableLookup.addLookupfield(fieldNum(TNK_TmpCustomerRate, SCBaseRate_C));
sysTableLookup.addLookupfield(fieldNum(TNK_TmpCustomerRate, ToRisk_C));
sysTableLookup.addLookupfield(fieldNum(TNK_TmpCustomerRate, LTSeiZhaCh_COCTR_C));
sysTableLookup.addLookupfield(fieldNum(TNK_TmpCustomerRate, SB_C));
sysTableLookup.parmQuery(q);
sysTableLookup.parmTmpBuffer(tmpCustomerRate);
sysTableLookup.performFormLookup();
}

用临时表作lookup数据源

标签:rms   sel   str   ddd   string   count   ram   cost   line   

原文地址:https://www.cnblogs.com/xtwkh1973/p/10993133.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!