SerializeValues ( )

Function stats

Average user rating
4.5000
108
146
9999
Support
FileMaker 7.0 +
Date posted
16 December 2008
Last updated
16 December 2008
Version
Recursive function
Yes

Author Info
 comment

3 functions

Average Rating 4.8

author_avatar



 

Function overview

Prototype

SerializeValues  ( textToIncrement;   listOfValues;   incrementBy )


Parameters

textToIncrement  any text that also contains a number


listOfValues  a list of carriage return-delimited values


incrementBy  integer


Description

Tags:  values   list  

Returns listOfValues with each value prefixed by textToIncrement incremented by the value specified in incrementBy. You can use positive or negative incrementBy values. A fractional incrementBy value will be rounded to the nearest integer.

Examples

Sample input

SerializeValues ( "0. " ; "a¶b¶c" ; 1 )


SerializeValues ( "Chapter 0 <tab> " ; "Alpha¶Bravo¶Charlie¶Delta¶Echo¶Foxtrot" ; 2 )


Sample output

1. a
2. b
3. c


Chapter 2 <tab> Alpha
Chapter 4 <tab> Bravo
Chapter 6 <tab> Charlie
Chapter 8 <tab> Delta
Chapter 10 <tab> Echo
Chapter 12 <tab> Foxtrot

 

Function code

/*
SerializeValues function

Author
*COMMENT Visual Realisation

Format
SerializeValues ( textToIncrement ; listOfValues ; incrementBy )

Parameters
textToIncrement - any text that also contains a number
listOfValues - a list of carriage return-delimited values
incrementBy - integer

Data type returned
text

Description
Returns listOfValues with each value prefixed by textToIncrement incremented by the value specified in incrementBy. You can use positive or negative incrementBy values. A fractional incrementBy value will be rounded to the nearest integer.

December 12, 2008
*/


Let ( [
countValues = ValueCount ( listOfValues )
] ;
Case ( countValues > 1 ; SerializeValues ( LeftValues ( listOfValues ; countValues - 1 ) ; textToIncrement ; incrementBy ) & ¶ )
&
Case ( countValues ; SerialIncrement ( textToIncrement ; countValues * incrementBy ) & GetValue ( listOfValues ; countValues ) )
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/146

    Prototype: SerializeValues( textToIncrement; listOfValues; incrementBy )
    Function Author: comment (http://www.fmfunctions.com/mid/108)
    Last updated: 16 December 2008
    Version: 1.1

*/
// ===================================

 

Comments

djoseff
06 January 2012



Love this, it's brilliant, and it works great. But in the second part, it calls the 'SerialIncrement' function which hasn't been added/defined in my system as a custom function. How does this do it's magic? Also, I'd love to see a good discussion about how recursive functions grind through, and how to design them intelligently - there remains some deep mysticism. Many thanks for sharing.
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)