Build Query Programs

Transform your business questions into Infactory Intelligent Queries. Infactory’s AI understands natural language and helps you create powerful analytics tailored to your data.
Infactory Intelligent Queries are reusable analytics that can be deployed as APIs. Think of them as smart functions that understand your data.

Your First Query Program

Let’s start with a fundamental business question that every investor needs to answer.
Query Program Creation showing the AI assistant in action
1

Create Your First Query

After your data source is connected:
  1. Look for the “Build” section in the left sidebar
  2. Click the ”+” button next to “Build”
  3. A new “Untitled query” appears in the Build section
  4. The main area shows “Use the assistant to build a query”
Build section showing + button to create new query
2

Use the AI Assistant

Now let’s use Infactory’s AI Assistant to create your query:
  1. Click the “Assistant” button on the right side
  2. A text box appears with “Use our AI Assistant to ask questions about your data”
  3. Type your question in natural language
Type a natural language question about your data. For example:
  • “What’s the average closing price for each ticker?”
  • “Show me the daily price change percentage for each stock”
  • “Which stocks have the highest trading volume?”
Press Enter or click the send button.
AI Assistant interface with stock analysis question
Infactory’s AI understands your business context. Start with simple questions, then build more complex analytics as needed.
3

Review the Generated Query

Infactory’s AI Assistant generates a complete query program and displays it in the code editor:
Query program code editor showing stock analysis calculation

Generated query program code in the editor

You’ll see:
  • The complete query program code
  • Clear variable definitions
  • Comments explaining the logic
  • Calculations based on your specific question
You can review and modify the code if needed. Infactory generates well-structured, readable code.
4

Test Your Query

Now run the query to see actual results:
  1. Click the “Run” button at the bottom right
  2. Results appear below the code editor with two view options:
Query results showing stock data with chart and table

Query results with Pretty and Raw view tabs

Pretty tab: A formatted table and chart visualization (default)
  • Automatic chart visualization for quick insights
  • Detailed data table below the chart
  • Column headers and rows match your query
  • Sortable columns, copy, and download options
Raw tab: The complete JSON response with metadata
  • Complete API response in JSON format
  • Includes metadata, execution trace, and timing information
  • Useful for debugging or integrating with other systems
Success! Your query has executed and returned results. The data is now ready for analysis or deployment as an API.
Automatic Save: When you run a query successfully, Infactory automatically:
  • Generates a descriptive name based on your query
  • Saves the query program to your Build section
You’ll see the query name change from “Untitled query” to something meaningful like “Stock Price Analysis” or similar.

Pro Tips for Query Creation

Be Specific

Include exact metric names and calculation methods

Add Context

Explain why you need the query for better results

Test First

Always test before saving to ensure accuracy

Iterate Quickly

Refine queries based on test results

Query Management

After creating your queries, you’ll see them in your Query Library:
Query library showing multiple deployed queries

Your query library with all created programs

Features available:
  • 📝 Edit queries anytime
  • 🔄 Clone and modify existing queries
  • 📊 View usage statistics

Common Issues & Solutions

Ready to Deploy?

You’ve built a powerful suite of analytics queries. Now let’s turn them into production APIs!

Continue to Deploy APIs

Transform your queries into live endpoints →

Progress Update: You’re about 4 minutes in and have created intelligent analytics that would typically take days to build. Next, we’ll deploy them as APIs!