Un ptit bouton bien pratique

Toutes les astuces qui n'entre pas dans les autres catégories

Un ptit bouton bien pratique

Messagepar Ahamay » 25 Sep 2009 à 13:43

A ajouter dans une ToolsBar :

File
> Preferences
> ToolBar Preference


[Customize] - [New] - [Button]

Et vous collez le code ci dessous :D


Formula :

REM {Get a listing of all the fields on the current document};
List := @DocFields;

REM {Possible data types to choose from.};
REM {I called Number Integer because use keyboard to select what you want with keyboard quicker.};

DataTypes := "Text" : "Date" : "Integer" : "Password" : "Name" : "Common Name" : "Remove Field" : "Text Multi Value" : "Date Multi Value" : "Integer Multi Value" : "Name Multi Value" : "Common Name Multi Value";

REM {Prompt for which field needs to be updated.};
EditField := @Prompt( [OkCancelList] ; "Select a field to alter" ; "Select the field you wish to alter:" ; "CustomerReply" ; List ) ;

REM {Prompt for which data type you would like the data to be};
REM {This needs to be done before value prompt to determine if the Picklist or any prompting needs to be used.};

DataType := @Prompt( [OkCancelList] : [NoSort] ; "data type or action for field: " + EditField ; "Please Select the correct data type or action for field: " + EditField ; "Text" ; DataTypes );

REM {Based on what type of data is being entered different prompts will happen if any at all.};
RawValue := @If(
@Contains( DataType ; "Name Multi Value" ); @PickList( [Name] );
@Contains( DataType ; "Name" ) ; @PickList( [Name] : [Single] );
DataType = "Remove Field" ; "" ;
@Contains( DataType ; "Multi Value" ); @Prompt( [OkCancelEdit] ;
"New Value for field: " + EditField ; "Please enter the new desired value for: " + EditField + " seperated with : for each value." ;
@Abstract([TextOnly] ; 254 ; "" ; @Text( EditField ) ) );
@Prompt( [OkCancelEdit] ; "New Value for field: " + EditField ;
"Please enter the new desired value for: " + EditField + "." ;
@Abstract([TextOnly] ; 254 ; "" ; @Text( EditField) ) ) );

REM {If data conversion doesn't work then don't set field.};
@If(
DataType = "Date" ; @If( @SetField( EditField ; @TextToTime(
RawValue ) ) );
DataType = "Integer" ; @If( @IsError( @TextToNumber( RawValue ) ) ;
"" ; @SetField( EditField ; @TextToNumber( RawValue ) ) ) ;
DataType = "Common Name" ; @SetField( EditField ; @Name( [CN];
RawValue ) ) ;
DataType = "Password" ; @SetField( EditField ; @Password( RawValue )
) ;
DataType = "Remove Field" ; @SetField( EditField ; @DeleteField ) ;
DataType = "Text Multi Value" ; @SetField( EditField ; @Explode(
RawValue ; ":" ) ) ;
DataType = "Date Multi Value" ; @SetField( EditField ; @TextToTime(
@Explode( RawValue ; ":" ) ) ) ;
DataType = "Integer Multi Value" ; @If( @IsError( @TextToNumber(
@Explode( RawValue ; ":" ) ) ) ; "" ; @SetField( EditField ; @TextToNumber(
@Explode( RawValue ; ":" ) ) ) ) ;
DataType = "Name Multi Value" ; @SetField( EditField ; @Explode(
RawValue ; ":" ) ) ;
DataType = "Common Name Multi Value" ; @SetField( EditField ; @Name(
[CN]; @Explode( RawValue ; ":" ) ) );
@SetField( EditField ; RawValue ));

""

Voila, maintenant, quand vous cliquez sur ce bouton, vous accéder directement à tous les champs du document actif, et vous pourrez, changer les valeurs, le type... ou encore supprimer un champ du doc en question.

Bien sur certains me diront que ca fait doublon (en - puissant) avec ce qu'on fait grâce à ytria ou TeamStudio.... mais quand on n'a ni l'un ni l'autre sous la main... 8)
Si haut que l'on soit placé, on n'est jamais assis que sur son cul (Montaigne) 8)
Avatar de l’utilisateur
Ahamay
Posteur expérimenté
Posteur expérimenté
 
Message(s) : 368
Inscrit(e) le : 27 Nov 2007 à 09:30
Localisation : Completement à l'ouest

Messagepar Michael DELIQUE » 25 Sep 2009 à 13:48

Cordialement

Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Messagepar Ahamay » 25 Sep 2009 à 13:53

Arf... bin oui, en plus simple,
Sorry, pourtant c'est pas faute d'avoir chercher !

Supprime mon tip si tu veux. :o\
Si haut que l'on soit placé, on n'est jamais assis que sur son cul (Montaigne) 8)
Avatar de l’utilisateur
Ahamay
Posteur expérimenté
Posteur expérimenté
 
Message(s) : 368
Inscrit(e) le : 27 Nov 2007 à 09:30
Localisation : Completement à l'ouest


Retour vers Divers