Integrate With ProcFu

It's pretty easy to surface your query results in ProcFu if you are looking to do so. Below are the steps you will need to take.

Step 1: Create A New Screen

The first thing you will want to do when integrating UseSQL with one of your Profu Apps is to create a new screen of type "Text Information". After in the section where is says markdown text you will need to make sure to add an html element, which is valid in the markdown text field, with an identifier. In this example we will name it "sql-result".

Step 2: Update Screen Behaviors

Now that we have a container to write our query results to. We can paste in some Javascript in the "On Render (Javascript)" section under the "Behaviors" tab. Below is some JavaScript you can copy and paste or replace with your own query, and a screenshot of the location to paste it into. Don't forget you can always build your queries in the sandbox at https://www.usesql.com/sandbox.

fetch('https://usesql.com/sql?query=SELECT%20a.Symbol%2C%20a.Security%2C%20b.Executive%20%0AFROM%20%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FList_of_S%2526P_500_companies%22%20a%20%0AJOIN%20%22https%3A%2F%2Fraw.githubusercontent.com%2Fdylanroy%2Fceo-dataset%2Fmain%2Fdata.csv%22%20b%20ON%20a.Security%20%3D%20b.Company&format=html&key={YOUR_API_KEY}')
  .then(response => response.text())
  .then(data => document.getElementById('sql-result').innerHTML = data);

You will take the script above, and add your API key, and place it in the "On Render (Javascript)" section as shown below.

Step 3: Save Your Results And Enjoy!

Save your results and visit your ProFu link.

Last updated