CameronWard301 / airtable

A Dokuwiki plugin to sync data from airtable
GNU General Public License v3.0
2 stars 2 forks source link

Problem when displaying "Multiple select" field #14

Open Joecorleone opened 3 years ago

Joecorleone commented 3 years ago

Hi, I am further playing around with the plugin and I just encountered a minor problem. I am trying to display values stored in a "Multiple select" field as a table or record (type). In case of a table the complete page remains white after saving, while for a record the field is skipped. The same seems to apply for other fields which can contain multiple entries:

CameronWard301 commented 3 years ago

Hi @Joecorleone The Airtable API is really poor at retrieving linked records and other similar information. Airtable only returns the ID of the element it links to. The only way I can see to help get round this is to make another request to the table that it links to. I'm struggling to come up with a solution that will solve this. (Could you provide the query string you are trying to use to get the information?)

Joecorleone commented 3 years ago

Hi, oh you are correct. I did not check this case. So, in general implementing "linked fields" and "Collaborator" is difficult and it does not matter, whether only one or multiple can be selected. Work for another day. Hopefully, the field "Multiple select" is easier to support. So "Single select" works fine, and as long as in the records for "Multiple select" at most one is selected, it is no problem. However, if there is one record with two of the options being selected there seems to be a problem. Here, is a screenshot of the setup in airtable. Screenshot The query in DokuWiki is {{airtable>type: "table" | record-url: "https://airtable.com/tblsDmkHP31Gtam3p/viwj8BBVJe8n8Z6Tt?blocks=hide" | fields: "Name","Priority", "Status" }}, where "Name" is just a text field, "Priority" is a rating field and "Stratus" is a multiple select field.

CameronWard301 commented 3 years ago

@Joecorleone Yeh, I really wish and hope Airtable updates their API its just very unhelpful to get basic information from. Grrrr.

Does the Status return an array of (string) items assigned to a record or is it the IDs of the items assigned to a record? If its an array of strings, it should be easy to implement.

Joecorleone commented 3 years ago

@CameronWard301 I see ... well I am happy that airtable provides an API ... still would be nice if it would be easier.

I will check tomorrow. I assume, that it is an array of Strings.

Edit: the API docu indicates, that it should return an array of strings. "Vertical" is a "Multiple select" field "Vertical": [ "Agtech" ]

CameronWard301 commented 3 years ago

@Joecorleone that's great to know! check my other comment on specifying field types and see what you think as a possible solution? :)

Joecorleone commented 3 years ago

If its an array of strings, it should be easy to implement.

You are absolutely correct. I just added a few lines to enable it. I also added an option to display table and record as a horizontal table, I updated my gist, and also the fork.

Edit: I just added an option to specify a base for the request. I needed this, as we are using two different bases. I am not quite sure about the security implications, though.

CameronWard301 commented 2 years ago

@Joecorleone Please can you check the latest dev branch? I think this is now resolved along with linked records 🥳