bouton servant à certaines operations sur un document

Toutes les astuces sur le langage de formule

bouton servant à certaines operations sur un document

Messagepar billbock » 27 Sep 2007 à 11:52

à mettre ds un bouton de tool bar

Ce code dans un bouton permet de remplacer les agents du type

refresh ou recuperation du UNID

cela per met de ne pas avoir d'agent "polluant la base"



Code : Tout sélectionner
ToolbarToolsLastSelection := "ToolbarToolsLastSelection";
ToolbarToolsLastProfile := "ToolbarToolsLastProfile";
ToolbarToolsLastEnvironmentVariable := "ToolbarToolsLastEnvironmentVariable";
ProfileName := "ChadSmiley Tools";
DefaultSelection := "Undo Replication Conflict";

REM {Get last selection for this database};
ToolbarToolsSelection := @GetProfileField( ProfileName ; ToolbarToolsLastSelection ; @UserName ) ;

Option := @Prompt( [OkCancelCombo] ; "Select Option" ; "What would you like to do:" ; @If( ToolbarToolsSelection = "" ; DefaultSelection ; ToolbarToolsSelection ) ; @Explode( "Undo Replication Conflict:Unlock Document:Refresh Selected Documents:Link Message:Workflow Formula Test:Agent Run:Agent Run Current:Get Notes ID:Get UNID:Get Parent UNID:Edit Profile Document:Get Environment Value:Set Environment Value"  ; ":" ) ) ;

REM {Set last selection for this database};
@SetProfileField( ProfileName ; ToolbarToolsLastSelection ; Option ; @UserName ) ;

@If( Option = "Refresh Selected Documents" ; @Command([ToolsRefreshSelectedDocs])  ; "") ;

@If( Option = "Undo Replication Conflict" ; @Do( @SetField("$REF" ; @DeleteField ) : @SetField( "$Conflict" ; @DeleteField ) ) ;

Option = "Unlock Document" ; @Do( @SetField("$Writers" ; @DeleteField ) : @SetField( "$WritersDate" ; @DeleteField ) ) ;

Option = "Agent Run" ; @Do ( @Command([RunAgent] ; @Prompt( [OkCancelEdit];"Run Agent" ; "Enter agent to run"; "" ) ) ) ;

Option = "Agent Run Current" ; @Do ( @Command([ToolsRunMacro]; $Title) ) ;

Option = "Link Message" ; @Do ( @Command([Compose]; @MailDbName; "Bookmark") ) ;

Option = "Edit Profile Document" ; @Do (
   @SetProfileField( ProfileName ; ToolbarToolsLastProfile ; @Prompt([OkCancelEdit]; "Open Profile Document"; "Profile Document Name (There should be a corresponding form or suborm)"; @GetProfileField( ProfileName ; ToolbarToolsLastProfile ; @UserName ) ) ; @UserName ) :
   @Command([EditProfile] ; @GetProfileField( ProfileName ; ToolbarToolsLastProfile ; @UserName ) ; @If( @Prompt( [YesNo] ; "Personal Profile" ; "Is this a personal profile?" ) ; @UserName ; "" ) ) ) ;

Option = "Get Environment Value" ; @Do (
   CurrentEnvVariable := @GetProfileField( ProfileName ; ToolbarToolsLastEnvironmentVariable ; @UserName ) ) :
   @Set( "NewEnvVariable" ; @Prompt([OkCancelEdit]; "Get Environment Value"; "Enter the name of the environment variable:"; CurrentEnvVariable ) ) :
   @SetProfileField( ProfileName ; ToolbarToolsLastEnvironmentVariable ; NewEnvVariable ; @UserName ) :
   @Prompt([OkCancelEdit]; "Environment Value"; "The value of the evironment variable '" + NewEnvVariable +  "':"  ;  @Environment( NewEnvVariable ) );

Option = "Set Environment Value" ; @Do (
   CurrentEnvVariable := @GetProfileField( ProfileName ; ToolbarToolsLastEnvironmentVariable ; @UserName ) ) :
   @Set( "NewEnvVariable" ; @Prompt([OkCancelEdit]; "Set Environment Value"; "Enter the name of the environment variable:"; CurrentEnvVariable ) ) :
@Prompt( [Ok]; "hi" ; NewEnvVariable ):
   @SetProfileField( ProfileName ; ToolbarToolsLastEnvironmentVariable ; NewEnvVariable ; @UserName ) :
   @SetEnvironment( NewEnvVariable ; @Prompt([OkCancelEdit]; "Environment Value"; "The new value of the evironment variable '" + NewEnvVariable +  "':"  ;  @Environment( NewEnvVariable ) ) );

Option = "Get Parent UNID" ; @Do ( @Prompt([OkCancelEdit]; "Parent UNID"; "Parent Unique ID"; @Text($REF)) ) ;

Option = "Get UNID" ; @Do ( @Prompt([OkCancelEdit]; "UNID"; "Unique ID"; @Text(@DocumentUniqueID)) ) ;

Option = "Get Notes ID" ; @Do ( @Prompt([OkCancelEdit]; "NoteID"; "NoteID"; @Text(@NoteID))  ) ;

Option = "Workflow Formula Test" ; @Do ( @Command([Compose]; @DbName; "(OS FormulaTest)") ) ;

"" )
Avatar de l’utilisateur
billbock
Modérateur
Modérateur
 
Message(s) : 310
Inscrit(e) le : 15 Fév 2007 à 13:58
Localisation : paris

Retour vers Formula