On synchronize Exact Online GL transactions with Invantive Control for Excel error: "You are trying to move cells within a table on the worksheet"

On synchronize Exact Online GL transactions with Invantive Control for Excel error: "You are trying to move cells within a table on the worksheet"

尝试将我的模型与 Excel 的 Invantive Control 同步时,出现以下错误:

这是完整的错误信息:

Type: System.Runtime.InteropServices.COMException
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Microsoft.Office.Interop.Excel.Range.Delete(Object Shift)
   at Invantive.Producer.Control.Utility.ResizeBlock(ModelCache modelCache, Workbook workbook, List`1 blocks, iea_blocks_v block, Cube currentCube, Cube desiredCube, Point3d startPoint, Int64 growLength) in File169:line 7968
   at Invantive.Producer.Control.Utility.AdjustBlockDimensionOneAxis(SystemWorkingContext context, ModelCache modelCache, Workbook workbook, iea_blocks_v currentBlock, Cube currentCube, Cube desiredCube, IEnumerable`1 anchoredBlocksResult, List`1 blocks, Point3d desiredStartPoint, Int64 growLength, iea_blocks_vBlk_repeat_rows_along adjustAxis, iea_blocks_vBlk_repeat_rows_direction adjustDirection) in File169:line 7293
   at Invantive.Producer.Control.Utility.AdjustBlockDimensions(SystemWorkingContext context, ModelCache modelCache, Workbook workbook, List`1 blocks, iea_blocks_v currentBlock, Cube currentCube, Cube desiredCube, Point3d desiredStartPoint) in File169:line 6617
   at Invantive.Producer.Control.SyncToDatabaseForm.SyncDownload(DoWorkEventArgs e) in File170:line 2173

解决此错误的步骤是什么?

编辑

Invantive Control中块上的SQL语句是:

select division_hid
,      division_name
,      reportingyear_attr
,      years_balance_code_attr
,      years_balance_description
,      open
from   BalanceLines
where  years_balance_balancetype_attr = "B"
and    reportingyear_attr = $X{eol_year_to}

$X{eol_year_to} 是对命名范围 eol_year_to 的引用,其值在查询中使用。

我在 Excel table 中添加了两列,一列用于 GL 帐户分类代码的垂直搜索,一列用于 GL 帐户分类描述。添加之后,模型不再与 Exact Online 同步。

Invantive Control 将数据放在 Excel table 中。我已将公式添加到此 table 的最后两列。 Invantive Control 可能不会移动这些公式,因为这会破坏 Excel table.

我们已将公式添加到 SQL 代码中。现在问题解决了。

您也可以从 Exact Online 中一次性获得 GL 帐户分类代码和描述,请使用类似下面的内容来获取所有 GL 交易的列表以及分类 code/description:

select tln.division division_hid
,      sdn.description division_name
,      tln.financialyear finyear_number_attr
,      tln.financialperiod finperiod_number_attr
,      tln.glaccountcode glaccount_code_attr
,      tln.glaccountdescription glaccount_description
,      tln.journalcode gltransaction_journal_code_attr
,      tln.currency gltransaction_journal_currency_code_attr
,      tln.amountdc amount_value
,      tln.vatpercentage amount_vatpercentage
,      tln.description
,      tln.accountname account_name
,      sysdate nu
,      '=I_EOL_GL_ACTCLN_CODE(,$C{E,.,.,^+4,.})' glactclncode
,      '=I_EOL_GL_ACTCLN_DESCRIPTION(,$C{E,.,.,^+4,.})' glactclndescription
from   transactionlines tln
join   systemdivisions sdn
on     sdn.code = tln.division
where  tln.financialyear   >= $X{eol_year_from}
and    tln.financialyear   <= $X{eol_year_to}
and    tln.financialperiod >= $X{eol_month_from}
and    tln.financialperiod <= $X{eol_month_to}
order 
by     tln.division
,      tln.financialyear
,      tln.glaccountcode 

平衡分类

在您的查询中,这将是:

select division_hid
,      division_name
,      reportingyear_attr
,      years_balance_code_attr
,      years_balance_description
,      open
,      '=I_EOL_GL_ACTCLN_CODE(,$C{E,.,.,^+3,.})' glactclncode
,      '=I_EOL_GL_ACTCLN_DESCRIPTION(,$C{E,.,.,^+3,.})' glactclndescription
from   BalanceLines
where  years_balance_balancetype_attr = "B"
and    reportingyear_attr = $X{eol_year_to}

列表达式

现在的流程是:

  • SQL 将指定期间内 Exact Online 的所有总帐交易加载到 Excel。
  • 通过按同步来执行此操作。
  • 然后计算 Excel 公式 I_EOL_GL_ACTCLN_CODEI_EOL_GL_ACTCLN_DESCRIPTION

这些公式采用唯一的部门代码(公司)加上至少 GL 帐户代码。由于 GL 帐户代码因 GL 事务而异,因此您希望引用查询的特定列的内容。您可以生成一个包含实际总帐科目代码的硬编码公式。 但最好从 Excel 中的另一个单元格中获取 GL 帐户代码。 $C{...} 语法允许您在同步期间将其替换为单元格引用。请查阅在线手册和模型编辑器向导。

$C{E,.,.,^+4,.}表示:

  • 枢轴法:使用X/Y方向是(E)xcel。您也可以使用 D 来考虑从数据库到 Excel 的任何转换,但很少使用。
  • .: 当前块,如'.'在 vi 中有时指的是 'here'.
  • .:当前 sheet,如“.”在 vi 中有时指的是 'here'.
  • ^+4:列,当前 Excel 行最左边的单元格 ('^'),然后是右边的四个单元格。
  • .: 当前行

您还可以在第 2 列和第 2 行的列表达式中再添加两个坐标,以指示单元格区域。