1
我有一個表叫司機和汽車,驅動器允許有最多3車。這怎麼可能做出這種關係?驅動程序表:姓名,車號 車表:品牌,型號,驅動程序如何限制關係數,Axapta的
我有一個表叫司機和汽車,驅動器允許有最多3車。這怎麼可能做出這種關係?驅動程序表:姓名,車號 車表:品牌,型號,驅動程序如何限制關係數,Axapta的
據我所知,獲得它的唯一方法是在Cars表上覆蓋ValidateWrite()。 在這種方法中,你可以通過電流驅動選擇汽車的數量和返回false,如果有三個或更多的汽車。
事情是這樣的:
public boolean validateWrite()
{
Cars cars;
;
select count(recid) from cars where cars.driver == this.driver;
if(cars.recid > 3)
{
info('The driver can not have more than three cars');
return false;
}
}
當然你需要有Cars.Driver指數更好的性能。
感謝底馬,答案是非常有益 – Vakhtang