1

I have a table which name PaymentLines and i want to control dueDate field of records which have same InvoiceId value. If there is a different dueDate value, info -> Records with the same InvoiceId value cannot have different dueDate values

How can i do this?

enter image description here

Mumble
  • 141
  • 1
  • 8

1 Answers1

2

It depends when you want to control for example if you want to do the control when you put the value in DueDate field overwrite Modified event of this field in datasource 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();        
}
Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29