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 7934669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:42:29+00:00 2026-06-03T21:42:29+00:00

I have a report that is querying a transaction table, I have simplified the

  • 0

I have a report that is querying a transaction table, I have simplified the table below:

CREATE TABLE [dbo].[NL_Trans](
    [NT_PRIMARY] [int] NOT NULL,
    [NT_CODE] [varchar][20] NOT NULL,
    [NT_CAT1] [varchar](6) NOT NULL,
    [NT_CAT2] [varchar](6) NOT NULL,
)

Data in the table is like:

NT_PRIMARY -- NT_CODE --- NT_CAT1 --- NT_CAT2
---------------------------------------------
      1       AB100         123         234
      2       AB200         124         234
      3       AB300         125         235
      4       AB400         126         235

The table has several years data and has 8 NT_CAT fields, these are numbers stored as varchar’s.

I have a large list of categories to limit the query to but I can’t find a way to limit this to ranges of text.
So far I have tried:

{NL_Trans.NT_CAT1} IN "124" to "125"

AND

(CDbl ({NL_Trans.NT_CAT1}) IN 124 to 125))

Neither of which are returning any results.

I can’t use a large list of OR statements as the ranges are more than 100 items in some cases meaning I’d need thousands of lines.

Can anyone give an alternative that will work (and leverage the Catagories index if possible) or tell me why either of the statements above are not working?

  • 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-06-03T21:42:30+00:00Added an answer on June 3, 2026 at 9:42 pm

    First of all, you cannot trust Crystal to evaluate a statement like "5" in "1" to "10". I don’t know the basis for these comparisons, but I would guess that it is based on ascii values of the leading digits or something like that.

    With that being said, converting to a double should work… Is it possible you have non-numeric characters in your NT_CAT fields? You should try something like this in your record selection formula and see if you have better luck:

    if not(isnull({NL_TRANS.NT_CAT1})) and isnumeric({NL_TRANS.NT_CAT1}) then cdbl({NL_TRANS.NT_CAT1}) in 124 to 125

    The downside to this is that Crystal won’t add this to the WHERE-clause to be handled on the SQL Server, it will do the selection on the local machine instead. To get around that performance hit, you can create a SQL Expression in Crystal that will do the string-to-numeric conversion for you. I don’t use TSQL so I’m not going to try and convert my Crystal code snippet to it, but if you created the SQL Expression {%ConvertCAT1ToNumeric} you could just use this in your selection formula:

    not(isnull({%ConvertCAT1ToNumeric})) and {%ConvertCAT1ToNumeric} in 124 to 125

    Good luck.

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

Sidebar

Related Questions

I have report page that uses dynamic xtrachart s. To dynamically create the xtrachart
I have a report that uses a TChart that I am maintaining. One of
I have a report that renders data returned from a stored procedure. Using profiler
I have a report that is used by a windows service and a form
I have a report that I'm exporting to PDF using the VS2008 version of
I have a report that is returning a one data field to a tablix
I have a report that I created in SQL Server Reporting Services 2008. I
i have a report that i have been sending a parameter to which worked
I have a report that shows all errors (if there are any) from a
The Particulars: I have a report that displays information about invoices. There is a

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.