Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005
    Posts
    79

    Unanswered: Formula field: display joined string of distinct values from column in detail section

    Hi,

    I'm wondering if this is possible to achieve in Visual Studio Crystal Reports using a formula field or a SQL expression field.

    I have an Invoice with Invoice Lines. Invoice Lines is my sub report. I want to concatenate all of the distinct values from a column in the sub report and display them in the Main report as a comma separated string.

    Ex:

    Invoice 1
    Date
    Customer Info
    Colours: Red, Blue, Green

    Details:
    Product 1 Red
    Product 1 Blue
    Product 2 Red
    Product 3 Green
    Product 3 Blue

    Thanks

  2. #2
    Join Date
    Jun 2005
    Posts
    79
    Managed to find the answer: http://diamond.businessobjects.com/node/251

    Make sure that the @SubReport formula field is placed in the Details section of your sub report.

    Here is how to get distinct values

    WhilePrintingRecords;
    Shared StringVar Result;
    if Length(Result) = 0 then
    Result := {Product.Colour}
    else
    if {Product.Colour} <> Previous({Product.Colour}) then
    Result := Result & ', ' & {Product.Colour};

Posting Permissions

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