Buffer-Handle Method FIND-FIRST, FIND-LAST - Forum - OpenEdge Development - Progress Community

Buffer-Handle Method FIND-FIRST, FIND-LAST

 Forum

Buffer-Handle Method FIND-FIRST, FIND-LAST

This question is not answered

Hello,

Is it a wanted behavior, that in case that the where condition of FIND-FIRST or FIND-LAST equals to ? is the same like ""?

DEFINE VARIABLE cWhere AS CHARACTER NO-UNDO.
cWhere = ?.

BUFFER Customer:FIND-FIRST(cWhere, NO-LOCK).
All Replies
  • I don't know if it's wanted, but it indeed appears to be the case.

    The following are equivalent and do a FIND using the primary index:

    - "WHERE TRUE",

    - ""

    - ?

  • Without any specified criteria, which index would you like if to use?

    This is expected behavior.

    Rick Terrell 
    Principle Consultant, Professional Services 
    Progress

    Sent from my iPhone
  • I would not allow a developer to rely on that, even if it appears to work.

    I'll take the risk of maybe misinterpreting the question.

    I think some developers would expext unkown where to throw an error.

    It's probably easier to find bugs if  where = ? would throw an error.

    In our code a lot of find statements are with no-error so throwing an "unknown where clause" error would go undetected .

    I've think we could use a "allow-unavailable" option on find to replace the no-error option.

    This option would preserve errors such as 7254 (*) without throwing an error when there is no record.

    (*) community.progress.com/.../eliminate_error_7254_and_allow_all_methodproperty_implementations_in_where_clauses

  • I would expect, that no record is found.

    We had a case (find and delete record) where we create a WHERE-Condition dynamically based on the primary unique index of a table, unfortunately, we did not handle the case with ? values in the query string algorithm, which results in WHERE-Condition = ?.

    But okay, then I will log an idea request.

    Kind regards,

    Lars Neumeier

  • Ok, but that was not the original question. The OP's question was about index *selection*, not whether a record would be found. 

    I would think that "where true" would act like a find first. Where = ? wouldn't find a record. 

    Rick Terrell 
    Principle Consultant, Professional Services 
    Progress

    Sent from my iPhone
  • Actually I would suspect that "where true" would be ambiguous if that were the only criteria. 

    Rick Terrell 
    Principle Consultant, Professional Services 
    Progress

    Sent from my iPhone
  • "where true" is not ambigous in a FIND-FIRST, only in a FIND-UNIQUE.

    I would also like WHERE ? to return no result or even throw an error...

    You'll have my vote if you create a feature request for this one ;-)

  • community.progress.com/.../buffer-object-handle_find-first_first-last_where_condition_equals_

  • @lars I voted for the idea.

    I also added a slightly related idea asking for an extra option on find to distinguish between records no being available and other errors.

    community.progress.com/.../unavailable-no-error_option_on_find__dynamic-find

  • Thank you and you got my vote too.