2017-06-23 37 views
0

我想根据连接表上的连接和特定条件填充TablA,我尝试了以下2个基于我发现的例子的作业。但我不确定如何填写表格,同时保持简单的工作。在连接表中插入多行

我曾尝试以下的工作,但两者给我一个语法错误:

static void AddDescription(Args _args) 
{ 

TableA  tableA; 
InventTable  inventTable; 
str    info; 
; 
ttsBegin; 



insert_recordSet tableA 
setting 
tableA.ItemId = inventTable.ItemId; 
tableA.Description = 'DescriptionHere'; 
join ItemId from inventTable 
where TableA.ItemId == inventTable.ItemId && 
where CriteriaA == CriteriaValueA; 

tableA.insert(); 

ttsCommit; 

    info("Done!"); 
} 

我也试过以下工作:

static void AddDescription(Args _args) 
{ 

TableA  tableA; 
InventTable  inventTable; 
str    info; 
; 
ttsBegin; 


insert_recordSet tableA 
join ItemId from inventTable 
where CriteriaA == CriteriaValueA; 

tableA.ItemId = inventTable.ItemId; 
tableA.Description = 'DescriptionHere'; 

tableA.insert(); 

ttsCommit; 

    info("Done!"); 
} 

显然我错过了一大步,任何人都可以给我一个方向去完成这份工作吗?

回答

4

您的语法不正确。查看文档的功能,因为它是非常全面的,有许多样本:https://msdn.microsoft.com/en-us/library/aa635694.aspx?f=255&MSPPError=-2147217396

这里是一个样本,可能是与你有关:

INSERT_RECORDSET tabEmplProj5 
    (
    Description 
    , EmployeeRecId 
    , ProjectRecId 
    ) 
Select 
    sDescriptionVariable 
    , RecId 
from 
    tabEmpl3 
    join 
     tabDept2 
     where tabEmpl3 .DepartmentGuid == tabDept2 .DepartmentGuid 
    join RecId 
     from tabProj4 
     where tabDept2 .DepartmentGuid == tabProj4 .DepartmentGuid 
;