Skip to Content

first function equivalent in Crystal Reports

I used Access and VB before CR. There is a function in the query builder in Access called "first" that retrieves the first value in a field with multiple options.

Finding a way to do this has become critical.

I have been told that if you put your fields in the header, you retrieve unique results. This isn't happening for me and it's bolixing up my report results.

Prior to April or so, Acctivate, the software the company I work for uses for sales and inventory, had a field called AlTProductID. It was in a one-to one relationship with the product data because it was in the same table. When they upgraded, the broke the field into its own table, meaning there could be multiple AltIDs for a given product. It took me a while to figure that out, since AltID (I thought) was a minor field and I inexcusably didn't include it in the detail, where I could look "under the hood" to see what the problem was with the results of the data.

Not every part has a duplicate AltID -- realizing that solved the issue for me as to why not every order had duplicates -- but enough do that this is an issue. If I could use FIRST on the field, that, I believe, would solve my problem. But CR doesn't offer that option.

So how do I do this in Crystal?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jul 12, 2020 at 10:10 PM

    Hi Janet,

    The equivalent would be the Minimum() function.

    Minimum({databaseField})

    would result in the first value from the entire dataset taking into account any sorting that has been applied.

    If you have a group and would like to find the first value in each group, you'd use:

    Minimum({databaseField}, {GroupField})

    -Abhilash

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.