Record vs. RecordRef

Sorry if this has been asnwered before, but I dont have time to search. Why would I want to use a recordref instead of a record variable? To ma it seems that everything a recordref can do, a record can do better. There must be something I am missing.

in case you do not know the table no. at design time, but you will get at the run time, then you have to use RecRef, because with RecRef you need not to specify the table no. and at runtime you can assign any table to recref.

I’m guessing they probably just threw it in order to make a generic “Change Log” possible. Of course, it does come in handy but only very seldom so.

Or if you have two (or more) different tables with which you have to do the same processing. I our company we have build our own procuct configurator. We have two tables (Open Configuration, Posted Configuration (Just like Sales Header vs. Sales Invoice)) GetConfigValue(ConfigStatus : 'Open,Posted';ConfigNo : Integer;ConfigOptionFieldNo : Integer) : Text[30] IF ConfigNo = 0 THEN EXIT(''); IF ConfigOptionFieldNo = 0 THEN // Field No from the 'Order Traveler Setup Table' EXIT(''); CASE ConfigStatus OF ConfigStatus::Open : ConfigRecRef.OPEN(DATABASE::"Config. Open Header"); ConfigStatus::Posted : ConfigRecRef.OPEN(DATABASE::"Config. Posted Header"); END; EVALUATE(MyRecordID,STRSUBSTNO('%1: %2',ConfigRecRef.NAME,ConfigNo)); IF NOT ConfigRecRef.GET(MyRecordID) THEN EXIT(''); ConfigFldRef := ConfigRecRef.FIELD(2); // Template No. RecRef.OPEN(DATABASE::"Order Traveler Setup"); FldRef := RecRef.FIELD(1); FldRef.SETFILTER(''); FldRef := RecRef.FIELD(2); FldRef.SETFILTER('%1|%2','',ConfigFldRef.VALUE); IF NOT RecRef.FIND('+') THEN EXIT; FldRef := RecRef.FIELD(ConfigOptionFieldNo); IF UPPERCASE(FORMAT(FldRef.TYPE)) <> UPPERCASE('CODE') THEN EXIT(''); ConfigRecRef.CLOSE; CASE ConfigStatus OF ConfigStatus::Open : ConfigRecRef.OPEN(DATABASE::"Config. Open Detail"); ConfigStatus::Posted : ConfigRecRef.OPEN(DATABASE::"Config. Posted Detail"); END; EVALUATE(MyRecordID,STRSUBSTNO('%1: %2,%3',ConfigRecRef.NAME,ConfigNo,FORMAT(FldRef.VALUE))); IF ConfigRecRef.GET(MyRecordID) THEN BEGIN ConfigFldRef := ConfigRecRef.FIELD(3); // Value EXIT(FORMAT(ConfigFldRef.VALUE)); END; EXIT(''); As you can tell, CASE ConfigStatus OF ConfigStatus::Open : ConfigRecRef.OPEN(DATABASE::"Config. Open Header"); ConfigStatus::Posted : ConfigRecRef.OPEN(DATABASE::"Config. Posted Header"); END; is all that I needed - Had I not used that, I basicly had to have my code doubled.

Hi Daniel, Get in touch with Aston/Tectura UK at … http://www.astonbusinesssolutions.co.uk They have some fastastic Change Log/low level write functionality to hand and its international functionality too. I know, cause I helped write it! Hope this helps David