Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

HI

I have a separate search screen and the problem is that if you do a search and there are no matches you get a dialog box with "Modify Find", "Continue" and "Cancel" options. If you click cancel the search page displays an entry which can be editted if someone thinks they are still in the search layout.

How can I make this cancel take them to another layout or run a script which goes back to finding.

Thanks

Simon

Version: Developer v6

Platform: Windows 2000

Posted

Hi Simon,

First you'll need to include the script step 'Set Error Capture [On]' prior to the Perform Find[ ] step in your script. That will suppress the dialog.

Then, immediately after the Perform Find step, you'll need to check for error code 401 (which indicates that there were no matching records). If error 401 is returned, you'll then be able to have your script gracefully return users whence they came. Eg:

Perform Find[ ]

If ["Status(CurrentError) = 401"]

Show Message ["your custom error message here"]

Go to Layout ["some other layout"]

Exit Script

End If

Exactly what actions you include in between the If[ ] and End If is up to you... wink.gif

Posted

Thats exactly what I want - however how do I revert to modify last find. As it I add this (modify last find) into the If[] if the next search is not in the database it doesn't show a custom message and goes back to the normal "modify find" or "cancel" dialog.

Thanks

Simon

Posted

This is the code I have

Set Error Capture[On)[

Freeze Window

Go to Layout ["Find"]

Refresh Window []

Go to Field[select/perform, "SurName"]

Toggle Status Area[Hide, lock]

Enter Find Mode[Pause]

Perform Find[Replace found set]

If ["Status(CurrentError) = 401"]

Show Message ["Not found"]

Perform Script ["GoToFind"] - THAT IS THE NAME OF THS SCRIPT

Exit Script

End If

Go to Layout["ContactsList1"]

Toggle Status Ares[show, lock]

The problem is as I said I want to beable to perform "modify last find" and also the line Go to Field [select/Perform, "SurName"] doesn't work when it performs the script in the IF[] it seems to go to the field above it that being FirstName??

Thanks

Simon

Posted

Hi,

I suggest you try re-arranging the script more along the lines of the following:

Set Error Capture[On]

Go to Layout ["Find"]

Toggle Status Area[Hide, lock]

Loop

Enter Find Mode[]

Go to Field[select/perform, "SurName"]

Pause/Resume Script []

Perform Find[Replace found set]

Exit Loop If ["not Status(CurrentError) = 401"]

Show Message ["Not found" buttons: "Try Again", "Cancel"]

If ["Status(CurrentMessageChoice) = 2"]

Go to Layout["original layout"]

Toggle Status Ares[show, lock]

Exit Script

End If

End Loop

Go to Layout["ContactsList1"]

Toggle Status Ares[show, lock]

There are many possible permutations, but the above may give you some more ideas to work with. smirk.gif

Posted

Move the Enter Find Mode [ ] step above the Loop step, add an Else step after the Exit Script step and a Modify Last Find step after the Else step.

If the cursor is going to the 'wrong' field, then your field order is probably not the way you think it is. Go into layout mode and verify that the field next to the Surname label is in fact the Surname field.

Posted

Ray->

Your method uses If ["Status(CurrentError) = 401"].

I've been using If ["Status(CurrentFoundCount) = 0"].

Is there an advantage to referencing the CurrentError instead of the CurrentFoundCount?

TIA,

Sam

Version: v7.x

Platform: Mac OS X Panther

Posted

I use If [status(CurrentError)]. I think it's all up to preference, and I always prefer to use a boolean argument, if possible. If you perform a find and there is an error, either no criteria was entered or no records were found. I respond to both situations in the same way, and both errors are caught with the boolean expression. If you wanted to be more anal about error-checking, then you could use 400 and 401 or 400 and Status(CurrentFoundCount). But I would say it's all up to your programming style. smile.gif

Posted

I had always used If ["Status(CurrentFoundCount) = 0"] statement aswell. In my opinion it is a bit neater.

I've actually come up with another way to do the modify find last which I'll post up but thanks for the input -Queue-

Simon

Posted

As Queue says, the tests Status(CurrentError) = 401 and Status(CurrentFoundCount) = 0 are functionally interchangeable. Both expressions produce a boolean result so there's an element of personal preference involved.

Although I have had occasion to use both, I tend to favour the Current Error check in most situations because:

a) I'm most often using it in a sequence along with other error checks so I'm already 'thinking in those terms', and

: It's marginally shorter to type.

smile.gif

Posted

I think defensively: there *may* be a find error that returns the whole found set, in which case a check on FoundCount won't work as expected.

(I don't know if there really is such an error condition, but that's the way I think.)

This topic is 7558 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
×
×
  • Create New...

Important Information

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