Is it possible to check whether the field has autoincrement property or not?

dreezdreez Member Posts: 56
Hi!

I'd like to know if there is a way (in AL code) to see whether the Field has AutoIncrement property or not?

I've already looked into fieldrefs, Field Table, but nothing useful crossed my mind.. :neutral:

Best Answer

Answers

  • rom2018rom2018 Member Posts: 13
    svzxp5g1ylvh.png
  • rom2018rom2018 Member Posts: 13
    edited 2022-11-23 Answer ✓
    pbo0u5bc251t.png
  • rom2018rom2018 Member Posts: 13
    edited 2022-11-23
    Name DataType Subtype Length
    ObjectMetadata Record Object Metadata
    ObjectXmlDoc DotNet System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    XMLAttribute DotNet System.Xml.XmlAttribute.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    XMLNsMgr DotNet System.Xml.XmlNamespaceManager.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    XMLNodeList DotNet System.Xml.XmlNodeList.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    XMLNode DotNet System.Xml.XmlNode.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    AutoIncrementText Text
  • dreezdreez Member Posts: 56
    edited 2022-11-23
    Thanks! Do you have an idea how to use that on cloud development? Unfortunately "Object Metadata" Table is available only OnPrem.
  • rom2018rom2018 Member Posts: 13
    Hi!

    I think. I don't have any good ideas right now.
  • dreezdreez Member Posts: 56
    Thanks anyway! :smile:
  • rom2018rom2018 Member Posts: 13
    Bad way.

    Plan A.
    Before: set static data(OnPrem mode)
    After: use on cloud mode

    Tab8618: Config. Template Header - set record with key "2000000136"
    Tab8619: Config. Template Line - set records with data TableNo and FieldNo with autoincrement

    if exist Tab+Field in Config. Template Line - is autoincrement field.

    Plan B. wait MS answer.
  • rom2018rom2018 Member Posts: 13
    Last BC::210
    Tab 370 Excel Buffer - update on Universal Code (available on cloud)
    CU700 - not...

    Wait next BC.
    Many impotent system property: Table, Page, Report, Codeunit::Metadata (virtual table) - available only OnPrem mode.

    Ahead many steps.
  • dreezdreez Member Posts: 56
    Thank you, I will try the "Plan A" for now :smiley:
  • lubostlubost Member Posts: 605
    1. Define required table as temporary
    2. Assign 0 (zero) to required field
    3. Insert record

    If value of required table changes => autoincrement field.
  • dreezdreez Member Posts: 56
    edited 2022-11-25
    lubost wrote: »
    1. Define required table as temporary
    2. Assign 0 (zero) to required field
    3. Insert record

    If value of required table changes => autoincrement field.

    The AutoIncrement property does not work with temporary tables.
Sign In or Register to comment.