我有一个名为 PaymentLines 的表,我想控制具有相同 InvoiceId 值的记录的 dueDate 字段,如果有不同的 dueDate 值,info -> 具有相同 InvoiceId 值的记录不能有不同的 dueDate 值。如果有不同的 dueDate 值,info -> 具有相同 InvoiceId 值的记录不能有不同的 dueDate 值。
我怎样才能做到这一点?
这取决于你什么时候想控制,例如,如果你想做控制时,你把值在 DueDate
字段覆盖 Modified
数据源中该字段的事件 PaymentLines
.
PaymentLines PaymentLinesCheck;
;
select PaymentLinesCheck where PaymentLinesCheck.InvoiceId == PaymentLines.InvoiceId &&
PaymentLinesCheck.DueDate != PaymentLines.DueDate;
if(PaymentLinesCheck)
{
info("Records with the same InvoiceId value cannot have different dueDate values");
//If you want to show an error message
//error("Records with the same InvoiceId value cannot have different dueDate values");
PaymentLines.DueDate = DateNull();
}