Field reference use and some possible problems

If you have a recordreference and want to use the value of a field in the recordreference, you can use it in this way:

 

TheRecordReference.FIELD(10).VALUE

 

You might even do something as this

 

SomeFieldReference.SETRANGE(TheRecordReference.FIELD(10).VALUE);

 

BUT for some reason, it can happen this crashes the NAV client. I had the problem with 50SP1  Build 30488 (I don’t know about more recent versions of NAV and even less in case you are in RTC). The weird part is that it doesn’t always happen. Recompiling the object doesn’t help. It might help adding some commands before the statement. So I think it is more a compiler-error.

 

But there is a way to completely avoid the problem. Don’t use TheRecordReference.FIELD(10).VALUE directly, but first put the field you need into a field-reference and then use the VALUE of that field-reference. Something like this:

 

SomeOTHERFieldReference := TheRecordReference.FIELD(10);

SomeFieldReference.SETRANGE(SomeOTHERFieldReference .VALUE);

One Response to “Field reference use and some possible problems”

  1. […] Bron : Kriki’s Dynamics NAV blog Lees meer… […]

Leave a Reply

You must be logged in to post a comment.

Create a new blog and join in the fun!