Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

BETTWEN in Search Expresions and commas

edited May 2008 in General
The problem I have is using BETWEEN operator when customer names have
commas like "NAME, S.A." or "Doe, John", etc.

if no commans in the name(s) like
ppReport1.AutoSearchFields[0].SearchExpression := Doe John,Smith James';

the result is OK:
WHERE ( Reparaciones.NOMBRE BETWEEN "Doe John" AND "Smith James" ):

but if names contains commas
ppReport1.AutoSearchFields[0].SearchExpression := 'Doe, John,Smith, James';

Produces:
WHERE ( Reparaciones.NOMBRE BETWEEN )

How can I tell ReporBuilder that a comma is part of the name and not the
separation of the 2 names ?

Thanks..
Modesto

Comments

  • edited May 2008

    RB 10 internally leverages TStringList.CommaText to parse the items. (Prior
    RB versions do not do this, so you might need to update).

    For your example, I would try the following

    '"Doe, John", "Smith, James'"

    From the Delphi help for TStringList.CommatText

    "When assigning CommaText, the value is parsed as SDF formatted text. For
    SDF format, strings are separated by commas or spaces, and optionally
    enclosed in double quotes. Double quote marks that are part of the string
    are repeated to distinguish them from the quotes that surround the string.
    Spaces and commas that are not contained within double quote marks are
    delimiters. "



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.