FixedLength

E' l'area in cui è possibile condividere funzioni personalizzate nate dalla creatività e l'esperienza degli sviluppatori FileMaker

Moderatore: Moderatori

Rispondi
raybaudi
Messaggi: 3616
Iscritto il: sabato 7 febbraio 2004, 1:00
Località: Roma
Contatta:

FixedLength

Messaggio da raybaudi » venerdì 7 aprile 2006, 18:19

Una funzione personalizzata per creare dei campi a lunghezza fissa, con carattere di riempimento a scelta e con allineamento a scelta.

Codice: Seleziona tutto

/*
FixedLength  function

Author
Daniele Raybaudi

Format
FixedLength ( text ; char ; charsNumber ; align )

Parameters
text - any text or text field
char - any character (or string);
charsNumber - the fixed length of the resulting string
align - text that can assume the value of "Left" or "Right"; an empty string is the same of "Left"

Data type returned
text

Description
Returns a fixed length string.
For example, FixedLength ("aaa"; "0" ; 10 ; "Left" ) returns: aaa0000000;
FixedLength ("aaa"; "0" ; 10 ; "Right" ) returns: 0000000aaa.

April 7, 2006
*/

Let(
string = 
Case (
charsNumber  > 0; char & FixedLength (""  ; char; charsNumber - 1 ; "");
""
);
Case(
align = "Left" or align = "";Left ( text & string ; charsNumber );
align = "Right"; Right ( string & text ; charsNumber);
string
)
)
Raybaudi FMP 12 Adv. Windows XP SP3

Rispondi