Methods in a find

Posted by Thomas Mercer-Hursh on 18-May-2014 14:22

I have a piece of code which looks like:

find bfDiskFile exclusive-lock
    where bfDiskFile.chSourceDirectory = obPathUtilities:SourceDirectoryFromPath( lchIncludePath )
    and   bfDiskFile.chPackage = obPathUtilities:PackageFromPath( lchIncludePath )
    and   bfDiskFile.chName = obPathUtilities:NameFromPath( lchIncludePath )
    no-error. 


Where the methods do as one would expect them to, i.e., extract that particular component from a full path to a file.

This find is failing.

However, if I rewrite to 

chSourceDirectory = obPathUtilities:SourceDirectoryFromPath( chPath ).
chPackage = obPathUtilities:PackageFromPath( chPath ).
chName = obPathUtilities:NameFromPath( chPath ).

find bfDiskFile exclusive-lock
    where bfDiskFile.chSourceDirectory = chSourceDirectory
    and   bfDiskFile.chPackage = chPackage
    and   bfDiskFile.chName = chName
    no-error. 

Then the find succeeds.  I have checked this many different ways and the methods always return what I expect and the table has the field values I expect.

Easy enough to fix this, now that I know what works, but is this in any way expected behavior?

11.3.2 

All Replies

Posted by Thomas Mercer-Hursh on 19-May-2014 10:44

I logged a support case on this and it led me to this KB article

progress.my.salesforce.com/.../000031951

This says that the problem is the no-error suppressing the message at run-time.  I contend that, if the error is predictable, one should at least get an error at compile time.  Better yet, it should just work.

Posted by Ken McIntosh on 19-May-2014 10:56


Hi Thomas,

The only time this error should be received is when executing code, called from a WHERE clause, which itself is firing a FIND, FOR EACH or OPEN QUERY statement. Is this the case for you? Do any of the methods in your WHERE clause execute such code?

I don't think this could truly be resolved in order to throw this error except at runtime.

Regards,
Ken Mc

Posted by Thomas Mercer-Hursh on 19-May-2014 11:12

One of the methods does a for each in a temp-table

  method public character SourceDirectoryFromPath (
      ipchFullPath as character
      ):
    define variable mchSourceDirectory as character no-undo.
    define buffer bfttPropath for ttPropath.
    
    for each bfttPropath by bfttPropath.inOrder:
      if substring(ipchFullPath, 1, length(bfttPropath.chPath)) = bfttPropath.chPath then leave.
    end.
    mchSourceDirectory = bfttPropath.chPath.
    return mchSourceDirectory.
  end method.


This thread is closed