Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 577903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:12:13+00:00 2026-05-13T14:12:13+00:00

The company I work for is using MacolaES for an ERP system. The SQL

  • 0

The company I work for is using MacolaES for an ERP system. The SQL Server database is structured such that when things are no longer considered active, they are moved from a set of “active” tables to a set of “history” tables. This helps to keep the “active” tables small enough that queries return quickly. On the flip side, the history tables are enormous. The appropriate columns are indexed in these tables, and if you query for something specific it returns quickly.

The problem is when you make a Crystal Report, which is prompting the user for a parameter. For reasons not known to me, Crystal parameters are not translated into SQL parameters, so you end up with queries selecting everything from the order header history table inner joined to everything in the order lines history table, which results in over 8 million rows.

Is there a way to get Crystal Reports to use the parameters in the SQL query instead of loading all the records and filtering after the fact? I read somewhere that a stored procedure should work, but I’m curious if an ordinary parameterized query is possible in the interest of saving my time.

Here is the selection formula:

(
    trim({Orderheader.ord_no}) = {?Order No}
)
and
(
    {Orderheader.ord_type} = 'O'
)
and 
(
    {orderlines.ord_type} = 'O'
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:12:14+00:00Added an answer on May 13, 2026 at 2:12 pm

    In Crystal Reports top menu go to Report / Selection Formulas / Record… There you can add a formula similar to:

    {table.field1} = {?Parameter1} and {table.field2} = {?Parameter2}
    

    That will add the condition to the where statement of the SQL query that the report will use to pull the rows.

    To verify what is the condition in the where statement that the report is using to pull the data you can go to the menu database / Show SQL Statement. That way you can verify that the report is using the parameters in the filter.

    Crystal Reports 8.5 User Guide mention the following tips:

    To push down record selection, you
    must select “Use Indexes or Server for
    Speed” in the Report Options dialog
    box (available on the File menu).

    In record selection formulas, avoid data
    type conversions on fields that are
    not parameter fields. For example,
    avoid using ToText( ) to convert a
    numeric database field to a string
    database field.

    You are able to push down some record selection formulas
    that use constant expressions.

    Your formula has a TRIM function on a field. The function against the field does not allow Crystal to push the formula to the database because is not a constant expression.

    If you really need to trim the order number field you should do it using SQL Expressions.

    References:
    Check out this article.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 279k
  • Answers 279k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Symfony 1.3+ has an option mime_type_guessers for sfValidatorFile which allows… May 13, 2026 at 3:26 pm
  • Editorial Team
    Editorial Team added an answer The BackgroundWorker component suits your need (sample code is there… May 13, 2026 at 3:26 pm
  • Editorial Team
    Editorial Team added an answer Using the JAR command: jar cf jar-file input-file(s) Using Maven:… May 13, 2026 at 3:26 pm

Related Questions

The company I work for is wanting to add blog functionality to our website
The company I work for want to put their help files online and they
the company I work for has a web-based user interface which paying clients log
At the company I work for date and time values have always been stored
SOLVED see Edit 2 Hello, I've been writing a Perl program to handle automatic

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.