lunedì 17 settembre 2007

Lotus Notes - Modificare qualsiasi campo da Barra degli strumenti

Per modificare i campi all'interno di un qualsiasi documento ho trovato utile questo tip trovato qui: Breaking Par Consulting

Per usarlo fare i seguenti passi:
1. andare in File -> Preferenze -> Barra degli strumenti
2. selezionare Personalizza barra (consiglio di scegliere la barra Universal);
3. trovare un'icona a proprio piacimento;
4. dargli un titolo;
5. inserire nella parte del codice il codice seguente...


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";
REM {Prompt for which field needs to be updated.};
EditField := @Prompt([OkCancelList]; "Select Field To Update"; "Select the field you wish to update:"; ""; List : "**** ADD A NEW FIELD ****");
REM {If adding a new field, prompt for the field name};
NewFieldName := @If(EditField = "**** ADD A NEW FIELD ****"; @Prompt([OkCancelEdit]; "Enter Field Name"; "Enter the name of the new field:"; ""); "");
CheckFieldName := @If(@IsMember(NewFieldName; List) & NewFieldName != ""; @Return(@Prompt([Ok]; "Already In List"; "The field " + NewFieldName + " already exists on the document.")); "");
UpdateVariable := @If(NewFieldName = ""; ""; EditField := NewFieldName);
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};
REM { Picklist or any prompting needs to be used.};
DataType := @Prompt([OkCancelList] : [NoSort]; "Choose Data Type"; "Please Select the correct data type or action for field: " + EditField; "Text"; DataTypes);
REM {For multi-valued fields, let the user choose the separator to use};
Separator := @If(@Contains(DataType; "Multi Value"); @Prompt([OkCancelList] : [NoSort]; "Choose Separator"; "Choose the separator to split out your multiple values"; ":"; (":" : ";" : "+" : "-" : "*")); "");
REM {Pull out the current value of the field};
CurrValue1 := @Eval(@Text(EditField));
CurrValue2 := @Abstract([TextOnly]; 254; ""; @Text(EditField));
CurrValue := @If(@IsNumber(CurrValue1) | @IsTime(CurrValue1); @Implode(@Text(CurrValue1); Separator); CurrValue2 != ""; CurrValue2; @Implode(@Text(CurrValue1); Separator));
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"; "Please enter the new desired value for: " + EditField + " seperated with " + Separator + " for each value."; CurrValue);
@Prompt([OkCancelEdit]; "New Value"; "Please enter the new desired value for: " + EditField + "."; CurrValue)
);
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 = "Password"; @SetField(EditField; @Password(RawValue));
DataType = "**** Remove Field ****"; @SetField(EditField; @DeleteField);
DataType = "Text Multi Value"; @SetField(EditField; @Explode(RawValue; Separator));
DataType = "Date Multi Value"; @SetField(EditField; @TextToTime(@Explode(RawValue; Separator)));
DataType = "Integer Multi Value"; @If(@IsError(@TextToNumber(@Explode(RawValue; Separator))); ""; @SetField(EditField; @TextToNumber(@Explode(RawValue; Separator))));
DataType = "Name Multi Value"; @SetField(EditField; @Explode(@Name([Canonicalize]; RawValue); Separator));
@SetField(EditField; RawValue)
);
""



et voilà il gioco è fatto.
Funziona solo su un documento alla volta quindi non per cose di massa, ma l'ho trovata utile.

3 commenti:

Giuseppe ha detto...

ocio: "sturmenti"

SteMax ha detto...

Già...

Grazie Giuseppe.

Corretto al volo

SteMax ha detto...

P.S.: il mio post è stato pubblicato anche su DominoPoint dove nei commenti è stata segnalata un'interessante evoluzione per permettere al pulsante di agire su + documenti.

Per vedere il tutto andate su DominoPoint