Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Golden Rule No5: Space out @if statements

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notestemplates.com/#GR5 or http://www.notestemplates.com/A555F9/nn.nsf/ByAlias/GR5


In Notes R3 this couldn't be done, but in R4 and R5 it can be and should be.





What is easier to read / understand / debug?

   This:

DBName := @Implode(@Explode(@Subset(@DbName;-1);"\\");"/");
@Command([FileSave]);
@Command([ToolsRunMacro]; "(UpdateFTIndex)");
@If(@ClientType="Web" & @IsNewDoc;
      @Command([OpenNavigator];Section);
@ClientType="Web" & ReadersDescriptive!="Anyone who can access the database.";
     @URLOpen("/" + DBName+"/int/GoBack4" );
@ClientType="Web";
    @URLOpen("/" + DBName+"/int/GoBack3" );
    @PostedCommand([FileCloseWindow])
)

 

     or this:

 

DBName := @Implode(@Explode(@Subset(@DbName;-1);"\\");"/");
@Command([FileSave]);
@Command([ToolsRunMacro]; "(UpdateFTIndex)");
@If(@ClientType="Web" & @IsNewDoc; @Command([OpenNavigator];Section);@ClientType="Web" & ReadersDescriptive!="Anyone who can access the database.";@URLOpen("/" + DBName+"/int/GoBack4" );@ClientType="Web";@URLOpen("/" + DBName+"/int/GoBack3" ); @PostedCommand([FileCloseWindow]))

 

It is the same code but is just displayed with spaces and extra return lines.

I rest my case.

Rule of thumb stick an extra carriage return in whenever there is a ";" or a bracket at the end of a line, not inside an @formula or as part of an @formula.

Try and indent the result of the @if.

e.g.

@if( condition1;
         do this;
 condition2;
         do this;
 condition3;
         @do(
             do this ;
             and this
          );
  else do this
)

 

 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Lotus Notes 5 All-in-one Certification Exam Guide by Libby Schwarz, Ben Malekzadeh
Sort out your CLP with this book.
See at: Amazon.co.uk | Amazon.com |