Home RAP

Removing parens from TdaSQLBuilder

edited June 2008 in RAP
I posted this earlier, but I can't find it so sorry if this is a double
post.
==============================================
I am following your (Nico's) advice and using TdaSQLBuilder to change the
WHERE clause.

I want to add several lines that include a parenthesis, So to make sure I
have not already added this section I go to the end
of the list and .Remove(index) them. This works except it does not remove
the parens. How do I remove the parens?

I can't CLEAR because the user might have added some of their own items to
the where clause.

Thanks,
Rob

Comments

  • edited June 2008
    Hi Rob,

    Below was my reply to your original post. I believe the reason you are
    unable to see your post is that you chose a subject that has already been
    used in this newsgroup. Some news readers (like outlook express) will see
    this as a response to the old thread.

    ---

    Parenthesis are TdaCriteria objects in the Items list as well. You can loop
    through the Items list and check the TdaCriteria.CriteriaType property to be
    sure you are about to remove the correct index. Then using the
    Remove(index) routine you should be able to remove any parenthesis. Remember
    that you will need to remove the starting and ending paren to have a valid
    SQL statement.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2008
    for j := i downto (i -14) do
    lSQLBuilder.SearchCriteria.Remove(j-1);

    This removes everything except the parenthesis.
    -Rob



  • edited June 2008
    Hi Rob,

    Yes, you are correct. I created a small patch that allows you to remove
    parenthesis using the SearchCriteria.Remove command. Send a small email to
    support@digital-metaphors.com requesting the patch and I'll send it to you
    asap.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.