Hi Alireza,
I know what table to use, I wanted to write an efficient select statement which is to get the latest phone, latest Mobile, latest email and latest fax regardless if they are primary or not...so if there are multiple phones then I need to get the last one inserted
So after thinking maybe I should do sth like this
Select maxOf(RecId),Type,isMobile from dirPartyContactV3Entity Group by Type,isMobile
Where dirPartyContactV3Entity.partyNumber=customer.PartNumber
Join dirPartyContactV3EntityLocal where dirPartyContactV3Entity.RecId=dirPartyContactV3EntityLocal.RecId
And now I can get the latest Locator from dirPartyContactV3EntityLocal
(I still didn't try it)
Or is this more effecient
Boolean Mobile
Boolean phone
Boolean fax
Boolean email
While select dirPartyContactV3Entity order by recId desc Where dirPartyContactV3Entity.partyNumber=customer.PartNumber
{
If(type=email and email = false)
{
Take locator value
Email = true
}
Else If(type=fax and fax = false)
{
Take locator value
fax=true
}
Else If(type=phone and IsMobile=false and phone = false)
{
Take locator value
Phone = true
}
Else If(type=phone and Ismobile=true and mobile = false)
{
Take locator value
Mobile= true
}
Else
{
Continue;
}
}