Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node reference lookup field #18

Closed
seth-shaw-unlv opened this issue Jul 3, 2019 · 2 comments
Closed

Node reference lookup field #18

seth-shaw-unlv opened this issue Jul 3, 2019 · 2 comments

Comments

@seth-shaw-unlv
Copy link
Contributor

We may have spreadsheet rows that need to reference other rows, so we need to be able to provide a look-up value.

For example, I have a parent record and two child records, all of which use the field_identifier column. I also have a field_member_of column (could be field_part_of, etc.). The child records don't have a node id for the parent record (because it hasn't been created yet) but it does have an identifier value.

field_identifier,field_member_of,title,file
example001,,Parent record,
example001-001,example001,Child one,example001-001.tif
example001-002,example001,Child two,example001-002.tif

We should be able to tell the workbench that a certain column (e.g. field_member_of) should look up the node id based on a configured node field (e.g. field_identifier).

mjordan added a commit that referenced this issue Jul 4, 2019
@mjordan
Copy link
Owner

mjordan commented Jul 4, 2019

In cde63d6 I've added code to accumulate a dictionary of CSV IDs as keys and node IDs as values. The user can specify which field in the CSV to use as the source of the IDs. This list can then be used to get the node ID later for adding child objects, etc. as you describe. For example, configuring a field in my CSV that contains an ID for each item, the item's ID and its node ID will be added to the list, which will end up looking like this (IDs from CSVs are keys, node IDs are values):

{'id-01': '53', 'id-02': '54', 'id-03': '55', 'id-04': '56', 'id-05': '57'}

We can add code later to pick out the node ID for the item matching the CSV ID. The field in the CSV should have the same name as a Drupal field, e.g. 1 field_identifier.

I haven't documented this in the README yet, but in the config file, the ID field is defined with the optional 'id_field' setting:

id_field: field_identifier

How does that sound as a preliminary implementation?

@mjordan
Copy link
Owner

mjordan commented Mar 30, 2020

@seth-shaw-unlv since node ID lookups are used in the new paged content functionality (which basically does what you describe), I'm going to close this issue. We can open new issues on this topic as the need arises.

@mjordan mjordan closed this as completed Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants