Results 1 to 10 of 10

Thread: creat a selectionformula using crystalreport1

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    97

    creat a selectionformula using crystalreport1

    hi,
    i using crystal report 7 and i facing a problem with the selectionformula.

    i load the report using this:

    CrystalReport1.SelectionFormula = "{lic.numero} like '1' and {lic.tic} like 'AB'"
    CrystalReport1.ReportFileName = "xxx.rpt"

    but this take some time to load the records because the report first load all records i see the progress bar and the number of records and he load all them he use the formula that i say and only display 1 record that is correct.

    how can i load only what i want?
    i have see other app using the same component and he as fast so its possible to filter just what i want without load all the content of db but who?

    any one can help me?
    thanks a lot

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: creat a selectionformula using crystalreport1

    Moved to Reporting

  3. #3
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: creat a selectionformula using crystalreport1

    may be try .SqlQuerystring.
    cr1.SqlQueryString = "Select col1, col2,.. FROM Table WHERE col1 LIKE 1 AND col2 LIKE 'AB'"
    col1, col2 etc are the cols you want to use

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    97

    Re: creat a selectionformula using crystalreport1

    hi, thanks for your help
    i have tryed the sql query but the result is the same when he stop loading the report he show the exact query but first he load all the records that exist in db:

    i dont understand why this happend

  5. #5
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: creat a selectionformula using crystalreport1

    CR is not the brightest app in the world. One thing I would definitely try is changing those likes. If you want to match exactly (no wild card used so I assume you want an exact match) I would use and =.

    A lot of the time CR wants all the records and then will try and apply the criteria after all records have been returned to it.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    97

    Re: creat a selectionformula using crystalreport1

    so what you are telling is that the cr get all records first and them filter what i want? there is no way to bypass that?
    i have see others app using the same cr and the app can show the exact record

    for the cr show the content i use this:
    CrystalReport1.Action = 1
    without this the cr don´t show anything may be the problem is here or not?

  7. #7
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: creat a selectionformula using crystalreport1

    What I'm saying is that CR is notorious for being ineffective at writing SQL. It wants to do all the work. This is especially true if you use a like clause in the criteria.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  8. #8
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: creat a selectionformula using crystalreport1

    I have used Crystal for many years and never had a problem getting it to create an efficient sql statement. Report Options, Formulas, Groups all affect the sql statement that is sent to the server and which processing Crystal decides it should perform itself.

    In version 8 there is an option called "Use Indexes or Server for Speed". If that option is off the Like clause is processed by Crystal. If it is on the Like clause is added to the Where clause. I don't know if this option exists in version 7.0.

    Does your report contain a Record Selection Formula? The Selection Formula assigned to the OCX control is merged with the existing formula. Is there a conflict?

    Does your report use multiple tables? Did you setup the Linking between the tables correctly?
    Last edited by brucevde; Mar 14th, 2008 at 12:19 PM.

  9. #9
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: creat a selectionformula using crystalreport1

    Version 8 was a big impovement from version 7.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  10. #10
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: creat a selectionformula using crystalreport1

    Like gary said why use LIKE when all you want is EXACT MATCH.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width