Coder Social home page Coder Social logo

Comments (2)

mesozoic avatar mesozoic commented on June 20, 2024 1

Reading the API documentation for multipleRecordLinks, it looks like the only options they support for creating or updating fields are linkedTableId and viewIdForRecordSelection. The inverseLinkFieldId and prefersSingleRecordLink properties are only available when reading the field metadata.

My understanding of how these fields work is that creating a link field from table1β†’table2 should automatically create the reciprocal field on table2, which you'd be able to identify by looking at the inverseLinkFieldId property. For example:

>>> created_field = table1.create_field('link', 'multipleRecordLinks', options={'linkedTableId': table2.schema().id})
>>> created_field
MultipleRecordLinksFieldSchema(type='multipleRecordLinks', options=MultipleRecordLinksFieldOptions(is_reversed=False, linked_table_id='tbl...', prefers_single_record_link=False, inverse_link_field_id='fldVIhHyCq5yUbWDb', view_id_for_record_selection=None), id='fld9GFYJfZo8hk1UG', name='link', description=None)
>>> inverse = next(
...     field for field in table2.schema(force=True)
...     if field.type == "multipleRecordLinks"
...     and field.options.inverse_link_field_id = created_field.id
... )
>>> inverse
MultipleRecordLinksFieldSchema(type='multipleRecordLinks', options=MultipleRecordLinksFieldOptions(is_reversed=False, linked_table_id='tbl...', prefers_single_record_link=False, inverse_link_field_id='fld9GFYJfZo8hk1UG', view_id_for_record_selection=None), id='fldVIhHyCq5yUbWDb', name='One', description=None)

I'm going to close this issue since it's not a bug with the pyairtable library. I suggest asking on the Airtable Community Forums if you have follow-up questions or feature requests.

from pyairtable.

BAPCon avatar BAPCon commented on June 20, 2024

https://community.airtable.com/t5/development-apis/creating-a-table-with-multiplerecordlinks-field-with-rest-api/m-p/157602#M12761

I can't find any working examples of this functionality even from the REST API, in the mean time I would suggest using lookup tables with one field being the primary field:

linked_field1 = table1.create_field(
    'contents', 
    'multipleRecordLinks', 
    options={
        'linkedTableId': table2.id,
    }
)

linked_field2 = table2.create_field(
      'accounts', 
      'multipleRecordLinks', 
      options={
        'linkedTableId': table1.id,
     }
)```

from pyairtable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.