Skip to main content
All CollectionsWorkflows & Reporting
Using URL Query Parameters to Adjust Dynamic Content of Shared View Reports
Using URL Query Parameters to Adjust Dynamic Content of Shared View Reports
Vince Lauffer avatar
Written by Vince Lauffer
Updated over a week ago

This document provides instructions on how to create dynamic custom reports in your application using EJS with the $params.query and $params.post variables. These variables allow you to pass parameters dynamically via URL query strings or POST requests from forms, enabling flexible filtering, sorting, and handling of different data inputs.


1. Introduction to $params.query and $params.post

  • $params.query
    ​
    This variable captures query parameters directly from the URL. It is useful for scenarios where you want to filter or sort data dynamically by modifying the URL parameters.

  • $params.post
    ​
    This variable handles data submitted via POST requests from a form. This allows you to send more complex data or sensitive information securely from a form submission to the report.


2. Usage Examples

Example 1: Using $params.query to Filter Records via URL

If you want to generate a report where the data is filtered based on specific criteria (e.g., userId or orderStatus), you can add these query parameters to the URL.

Sample URL:

In EJS:

<% if ($params.query.userId) { %>
<h2>Report for User ID: <%= $params.query.userId %></h2>
<% } %>


<% if ($params.query.orderStatus) { %>
<p>Filtering by Order Status: <%= $params.query.orderStatus %></p>
<% } %>

Result:

Report for User ID: 123

Filtering by Order Status: pending


​

Example 2: Using $params.post to Handle POST Form Data

When submitting a form to your report via POST method, $params.post allows you to capture the form data and dynamically generate the report.

Sample Form (HTML):

<form action="https://fulcrumapp.io/run/0141f02a-d339-4943-a386-41ac2f0ac687?token=cce2c5aabd130b26b9f5" method="post">
<input type="text" name="userId" value="123">
<input type="text" name="orderStatus" value="completed">
<button type="submit">Submit</button>
</form>

In EJS:

<% if ($params.post.userId) { %>
<h2>Report for User ID: <%= $params.post.userId %></h2>
<% } %>

<% if ($params.post.orderStatus) { %>
<p>Filtering by Order Status: <%= $params.post.orderStatus %></p>
<% } %>

Result:

After submitting the form, the report will display:

Report for User ID: 123

Filtering by Order Status: completed


3. How to Use Fulcrum Shares Utility to Get Dynamic Links

To generate a dynamic link that can accept either POST data or query parameters, you must first obtain a public link using Fulcrum's Shares Utility.

Steps:

  1. Go to the Fulcrum Shares Utility on the platform.

  2. Select the report you want to make dynamic.

  3. Generate and copy the public link.

  4. Use this link in your application to send information either through GET (modifying query params) or POST (via forms).

Example of a Public Link:

You can append query parameters directly to this URL or use it as the action URL in a form to submit data via POST.


4. Example Use Case: Filtering a Report by Date Range

Imagine you want to filter a report by a date range entered by a user through a form. Here's how you can achieve that:

Step 1: Create an HTML Form (Report Source)

<form action="https://fulcrumapp.io/run/0141f02a-d339-4943-a386-41ac2f0ac687?token=cce2c5aabd130b26b9ff5" method="post">
<label for="startDate">Start Date:</label>
<input type="date" name="startDate" id="startDate">

<label for="endDate">End Date:</label>
<input type="date" name="endDate" id="endDate">

<button type="submit">Generate Report</button>
</form>

Step 2: Handle the Data in EJS (Report Destination)

<% if ($params.post.startDate && $params.post.endDate) { %>
<h2>Report from <%= $params.post.startDate %> to <%= $params.post.endDate %></h2>
<% } else { %>
<p>Please provide a valid date range.</p>
<% } %>

Result:

If the user selects a date range and submits the form, the report will display something like:

Report from 2024-10-01 to 2024-10-07


5. Summary

  • Use $params.query to pass parameters via URL for quick filtering or sorting.

  • Use $params.post to capture form data via POST requests for more secure and detailed submissions.

  • Leverage Fulcrum Shares Utility to create public links and allow dynamic interaction with your reports.

  • This flexibility allows you to create powerful, dynamic reports that adapt based on the input provided by users.


6. Additional Tips

  • Combining POST and GET: You can combine both methods in your reports to handle different types of inputs.

  • Testing URLs: Always test your query params and POST data in a local environment before going live.

Did this answer your question?