Показать сообщение отдельно
Старый 20.10.2008, 11:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
palleagermark: Saving the reference to a unique record as a string
Источник: http://palleagermark.blogspot.com/20...record-as.html
==============

Sometimes you have have to store a unique reference to record as a string, for example if you want to include this reference in an XML file.

Merely converting the RecId to a string is not always a good idea. The best choice for identifying the record may be another unique key of the table, especially if the table doesn't have a RecId index.

On the Global class there is a method to analyze the unique keys of a table and give you the unique key as a string. This is the record2Dynakey method.

The key is encoded in the string like this:
[fieldid:strvalue][fieldid2:strvalue][fieldid3:strvalue]

Later when you want to convert the string, representing the key, to an actual record, just call the dynaKey2Record method.

You should not use this technique for long term storage of keys, since renaming primary keys or changing the datamodel might break the ability to restore the string into the right record or restoring it in the most sufficient way.

Источник: http://palleagermark.blogspot.com/20...record-as.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.