Hi,
I apply the following code and I got the " Value missing from field("StatementClosingBalance") "(See attached)
But the weird thing is I saw the Value of SatementClosingBalance is 469513.69 on the screen.So what is missing actually?
Secondly, I apply the same code to DIFFERENT Document Definition(refer to same kind of document) and it works well except this one.
<Code Start>
using System;
string StatementClosing=Context.Field("StatementClosingBalance").Text;
int TotalCount=Context.Field("Balance").Items.Count;
decimal temp=0;
decimal LastBalance;
Decimal.TryParse(Context.Field("Balance").Items[TotalCount-1].Text,out LastBalance);
Decimal.TryParse(StatementClosing,out temp);
if (temp==LastBalance)
{
Context.Field("StatementClosingBalance").IsVerified=true;
Context.Field("StatementClosingBalance").HasRuleError=false;
Context.Field("Balance").Items[TotalCount-1].HasRuleError=false;
}
else
{
Context.CheckSucceeded=false;
Context.ErrorMessage="Account Closing Balance do not match with the last running balance.";
Context.Field("StatementClosingBalance").HasRuleError=true;
Context.Field("Balance").Items[TotalCount-1].HasRuleError=true;
for (int i=0;i<TotalCount-1;i++)
{
Context.Field("Balance").Items[i].HasRuleError=false;
};
}
<Code End>
Appreciate if anyone can share me some advice on this situation.
Thanks
コメント
1件のコメント
I thought I fixed the issue.
Originally , I accidentally put the script on the highest level in the "tree structure"(Project level), but not in the field ("StatementClosingBalance").
When I put the script in "StatementClosingBalance", it works.
But what is the reason of such error?
I thought it would be safe for me to put all the codes on the highest level in the tree structure.
Thanks
サインインしてコメントを残してください。