Skip to Content
author's profile photo Former Member
Former Member

Crystal Reports Longest Match

One of the parameters in my report is comparing two fields to see if field A is contained within field B. Both are product types but one of the B can be longer than field A as we have what we call dash types (Field A: WSL-2010, Field B: WSL-2010-20). I have that section working by using Instr({po.product_type},{LaserMOS.Type}) > 0. The problem that I am having is that I also have an entry in table A that makes Field A WSL-2010-20. So I am coming back with two matches. What I want to do is only bring back the longest match in table A. I don't know if this is the correct place to ask but I am not a programmer so I am not sure how to do this. Any advice would be helpful. Thanks.

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Feb 27, 2017 at 09:22 AM

    Not really sure how your data looks but one way you can do this is group data on field B and second sort data by Field A

    Place all you details in Group footer and then your formula will only show latest record A which should be the longest assuming the sort order is correct.


    Add comment
    10|10000 characters needed characters exceeded