Skip to Content

Crystal report - Finding partial matching string in Array

Hi

I am working on a crystal report and have a requirement to remove the duplicate(partial/like) match entries from a multiple list parameter.
So I have a multi value parameter which might contain below value

Accounts

ABC-12345-000
XYZ-56982-111
ABC-98090-222
UXY-12334-333

What I required to send a message to a user if there are partial duplicate before first '-' like in this case, there are two ABC entries users choose, and I need to display a message to a user to pick just one entry, lfrom similar account like below:

ABC-12345-000 OR ABC-98090-222
XYZ-56982-111
UXY-12334-333

Thanks, Saif

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jul 14, 2017 at 07:49 AM

    Create a formula

    @Start

    Left(yourfield, 3)

    Group on this formula and suppress details and group header line and add the fields you want to display to Group footer

    Add this formula to Group Header

    @Reset

    Whileprintingrecords;

    Global stringvar accounts:=' '

    Global numbervar n :=1;

    Add this formula to details

    @Eval

    whileprintingrecords;

    Global stringvar accounts;

    Global numbervar n;

    If n = 1 then Accounts:= Yourfield

    If count(yourfield, @Start) >1 then Accounts:= Accounts &' OR ' & Yourfield;

    Accounts;

    In Group footer place this formula

    @Display

    Whileprintingrecords;

    Global stringvar accounts;

    Ian

    Add comment
    10|10000 characters needed characters exceeded