用临时表作lookup数据源
Posted xtwkh1973
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用临时表作lookup数据源相关的知识,希望对你有一定的参考价值。
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数据源的主要内容,如果未能解决你的问题,请参考以下文章