Jump to content

Bypass no record found


This topic is 7143 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I run a script, that automate one of my daily processes.

It executes a find, and perform something if there is a found set, or does not perform anything if nothing is found.

The problem arise when no records are found. First, 9i get a message box to notify me

1) is there a way to bypass this message

The only way i found to count how many records were found was to execute a loop through the found set, and add 1 to a global field for each record going through the loop. However, if i find 0 records, the loop will still run 1 time and set my global field to 1.

2) any way i can use a function like foundCount, or check how many results were found?

here are my scripts:

go to record requets page[first]

Loop

copy[select,"Body#"]

Perform Script[subscript.....]

<<this is the subscript>>

set field global,0

enter find mode

paste[select,No style,"Body#"]

Perform Find[]

Enter Browse mode[]

Go to record request page [First]

Loop

set field[global,global+1]

go to record request [exit after last, Next]

End Loop

if [XXXX::global>0]

set field body#, "Body#&"-Revision"&XXXX::global"]

end if

go to record request page [exit after last, Next]

end loop

David

Link to comment
Share on other sites

David,

At the start of your script insert the step SetErrorCapture [On]

After the Perform Find[] step

code:


If Status CurrentError = 401

(do the bits you want if no records were found

might include a ShowMessage step to let the user

know that no records were found. You may need to

Exit the script here as well)

Else

SetField[Global,Status(CurrentFoundCount)

EndIf

BTW, I hope you have "[]" after your EnterFindMode step.

Russ

[ April 03, 2002, 05:07 PM: Message edited by: Russell Baker ]

Link to comment
Share on other sites

shocked.gif Jeez, I'm frantically scouring my recent posts, and other forums, because, "I know I answered this, where is my post?" Aha! David asked the exact same question on the [email protected] mailing list. Never mind.
Link to comment
Share on other sites

quote:

Originally posted by Old Advance Man:

Don't use StatusCurrentError=401.

While I usually use the Status ( CurrentFoundCount ) = 0 test, is there some issue with the Status ( CurrentError ) = 401 that causes you to recommend the other method? Or is there some cases where the returned set of 0, but 401 is not generated?

Link to comment
Share on other sites

quote:

Originally posted by CaptKurt:

quote:

Originally posted by Old Advance Man:

Don't use StatusCurrentError=401.

While I usually use the Status ( CurrentFoundCount ) = 0 test, is there some issue with the Status ( CurrentError ) = 401 that causes you to recommend the other method? Or is there some cases where the returned set of 0, but 401 is not generated?


Just in case you've put some comments before testing for error ,because it would reset current error to 0 crazy.gif

HTH

Dj

Link to comment
Share on other sites

This topic is 7143 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.