Skip to content

Commit

Permalink
Deployed 3752529 with MkDocs version: 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Jan 30, 2024
1 parent b1e94a3 commit 7af61f7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
54 changes: 26 additions & 28 deletions generating_csv_files/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,6 @@
Using a Drupal View to identify content to export as CSV
</a>

</li>

<li class="md-nav__item">
<a href="#using-a-drupal-view-to-generate-a-media-report-as-csv" class="md-nav__link">
Using a Drupal View to generate a media report as CSV
</a>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -996,13 +989,6 @@
Using a Drupal View to identify content to export as CSV
</a>

</li>

<li class="md-nav__item">
<a href="#using-a-drupal-view-to-generate-a-media-report-as-csv" class="md-nav__link">
Using a Drupal View to generate a media report as CSV
</a>

</li>

<li class="md-nav__item">
Expand Down Expand Up @@ -1117,10 +1103,10 @@ <h3 id="using-a-drupal-view-to-identify-content-to-export-as-csv">Using a Drupal
<p>You can use a new or existing View to tell Workbench what nodes to export into CSV. This is done using a <code>get_data_from_view</code> task. A sample configuration file looks like this:</p>
<pre><code class="language-yaml">task: get_data_from_view
host: &quot;http://localhost:8000/&quot;
view_path: '/workbench-export-test'
view_path: '/daily_nodes_created_test'
username: admin
password: islandora
content_type: my_custom_content_type
content_type: pubished_work
export_csv_file_path: /tmp/islandora_export.csv
# If export_csv_field_list is not present, all fields will be exported.
# node_id and title are always included.
Expand All @@ -1129,7 +1115,7 @@ <h3 id="using-a-drupal-view-to-identify-content-to-export-as-csv">Using a Drupal
# Note that values in the 'view_parameters' configuration setting are literal
# parameter/operator/value strings,not YAML key: value pairs.
view_parameters:
- 'title_contains=Debate'
- 'date=20231202'
</code></pre>
<p>The <code>view_path</code> setting should contain the value of the "Path" option in the Views configuration page's "Path settings" section. The <code>export_csv_file_path</code> is the location where you want your CSV file saved.</p>
<p>In the View configuration page:</p>
Expand All @@ -1148,18 +1134,30 @@ <h3 id="using-a-drupal-view-to-identify-content-to-export-as-csv">Using a Drupal
<p class="admonition-title">Warning</p>
<p>If your View includes nodes that you do not want to be seen by anonymous users, or if it contains unpublished nodes, adjust the access permissions settings appropriately, and ensure that the user identified in your Workbench configuration file has sufficient permissions.</p>
</div>
<p>If your View is configured to include Contextual Filters, and those contextual filters are exposed as "Query parameters", you can include the value of the filter in your configuration file using the <code>view_parameters</code> config setting, as illustrated in the sample configuration file above. The configuration in the View's Contextual Filters for this type of parameter looks like this:</p>
<p>If your View is configured to include Contextual Filters, and those contextual filters are exposed as "Query parameters", you can include the query parameter name and its value in your configuration file using the <code>view_parameters</code> config setting, as illustrated in the sample configuration file above. The configuration in the View's Contextual Filters for this type of parameter looks like this:</p>
<p><img alt="Sample REST export display" src="../images/REST_export_query_paramters.png" /></p>
<p>Some things to note:</p>
<ul>
<li>REST export Views displays don't use fields in the same way that other Views displays do. In fact, Drupal says within the Views user interface that for REST export displays, "The selected style or row format does not use fields." Instead, these displays export the entire node in JSON format. Workbench iterates through all fields on the node JSON that start with <code>field_</code> and includes those fields, plus <code>node_id</code> and <code>title</code>, in the output CSV.</li>
<li>If you don't want to export all the fields on a content type, you can list the fields you want to export in the <code>export_csv_field_list</code> configuration option.</li>
<li>Only content from nodes that have the content type identified in the <code>content_type</code> configuration setting will be written to the CSV file.</li>
<li>If you want to export term names instead of term IDs, include <code>export_csv_term_mode: name</code> in your configuration file. The warning about this option slowing down the export applies to this task and the <code>export_csv</code> task.</li>
</ul>
<h3 id="using-a-drupal-view-to-generate-a-media-report-as-csv">Using a Drupal View to generate a media report as CSV</h3>
<p>You can get a report of which media a set of nodes has using a View. This report is generated using a <code>get_media_report_from_view</code> task, and the View it uses is the same as the View described above (in fact, you can use the same View with both <code>get_data_from_view</code> and <code>get_media_report_from_view</code> tasks). A sample configuration file looks like:</p>
<pre><code class="language-yaml">task: get_media_report_from_view
<p>By adding Contextual Filters to your View display, you can control what nodes end up in the output CSV by including the value you want to filter on in your Workbench configuration's <code>view_parameters</code> setting. In the screenshot of the Contextual Filter shown here, the query parameter is <code>date</code>, so you include that parameter in your <code>view_parameters</code> list in your configuration file, e.g.:</p>
<p>``
view_parameters:
- 'date=20231202'</p>
<pre><code>
will set the value of the `date` query parameter in the &quot;Created date&quot; Contextual Filter to &quot;20231202&quot;.

Some things to note:

* Note that the value you include in `view_parameters` only appies to your View's Contextual Filters. Any &quot;Filter Criteria&quot; you include in the main part of your View configuration also take effect. In other words, both &quot;Filter Criteria&quot; and &quot;Contextual Filters&quot; determine what nodes end up in your output CSV file.
* REST export Views displays don't use fields in the same way that other Views displays do. In fact, Drupal says within the Views user interface that for REST export displays, &quot;The selected style or row format does not use fields.&quot; Instead, these displays export the entire node in JSON format. Workbench iterates through all fields on the node JSON that start with `field_` and includes those fields, plus `node_id` and `title`, in the output CSV.
* If you don't want to export all the fields on a content type, you can list the fields you want to export in the `export_csv_field_list` configuration option.
* Only content from nodes that have the content type identified in the `content_type` configuration setting will be written to the CSV file.
* If you want to export term names instead of term IDs, include `export_csv_term_mode: name` in your configuration file. The warning about this option slowing down the export applies to this task and the `export_csv` task.

### Using a Drupal View to generate a media report as CSV

You can get a report of which media a set of nodes has using a View. This report is generated using a `get_media_report_from_view` task, and the View it uses is the same as the View described above (in fact, you can use the same View with both `get_data_from_view` and `get_media_report_from_view` tasks). A sample configuration file looks like:


```yaml
task: get_media_report_from_view
host: &quot;http://localhost:8000/&quot;
view_path: daily_nodes_created
username: admin
Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

Binary file modified sitemap.xml.gz
Binary file not shown.

0 comments on commit 7af61f7

Please sign in to comment.