@IsValid

I hardly ever see the @IsValid function used in actions that try to Save and Close a document.

You Can View User Feedback To This Tip

I hardly ever see the @IsValid function used in actions that try to Save and Close a document.

Here is the problem:

1. User clicks Save & Close action button.

2. The @Command([FileSave]) tries to save the form. When it fails validation it returns the @Failure message.

3. The user clicks on OK on the failure message and the formula continues with the @Command([FileCloseWindow]) command.

4. This causes a File Save window to appear, if the user clicks yes, the validation is run again.

To Fix this use the following code:

When a user clicks on Save and Close.

 @If(@IsValid;@Do(@Command([FileSave]);@Command([FileCloseWindow]));@Return(""))

USER FEEDBACK TO THIS TIP

 

  • The most frequent code for "Save & Close" button is:
     @Command ([FileSave]); @Command ([FileCloseWindow]);
    

    But if the document cannot be saved (due to input validation errors), you will get a "save document?" message box caused from the FileCloseWindow command.

    This tip suggests using @IsValid to check if the document can be saved. But there is a better way to do this: The @Command([FileSave]) returns a value: @True, when successful, @False otherwise.

    So the shortest and best code for an "OK" or "Save & Close" Action is:

     @If (@Command([FileSave]);@Command([FileCloseWindow]);"")
    
    —Hans-Peter Kuessner
This was last published in May 2002

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close