1

Some code is written to get data from a field without using the .Value property:

PS_BI_HDR.INVOICE

And other code uses the .Value property:

PS_BI_HDR.INVOICE.Value

What is the difference?

Are there times when one should be used instead of the other?

qyb2zm302
  • 6,458
  • 2
  • 17
  • 17
kh.tab
  • 1,284
  • 3
  • 13
  • 25

1 Answers1

2

PS_BI_HDR.INVOICE may implicitly use the .Value property in some cases (e.g. assignment), but it is a field reference.

(PS_BI_HDR.INVOICE is actually a simplified version of GetRecord(Record.PS_BI_HDR).GetField(Field.INVOICE))

If you intend to use the value stored in the field, you should explicitly use the .Value property, if anything to avoid mistakes.

Based
  • 950
  • 7
  • 18
  • PS_BI_HDR.INVOICE could show the value without .Value but if we use GetRecord().GetField() we must use .Value to get field value – kh.tab Feb 25 '20 at 14:40
  • 1
    @kh.tab as I pointed out "_PS_BI_HDR.INVOICE may implicitly use the .Value property_" and as any programmer should tell you, never count on implicit functionality. – Based Feb 25 '20 at 15:00