FMPRO-L Archives

March 2015, Week 1

FMPRO-L@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Tom Elliott <[log in to unmask]>
Reply To:
FileMaker Pro Discussions <[log in to unmask]>
Date:
Fri, 6 Mar 2015 21:20:51 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (111 lines)
Tami

how about:

If ( not IsEmpty ( theList ) ;
	Let (
		vc = ValueCount ( theList ) ;
		List (
			If ( vc > 1 ; nbrList ( LeftValues ( theList ; vc - 1 ) ) ) ;
			vc & ". " & GetValue ( theList ; vc )
			)
		)
	)

cheers

Tom Elliott

> On 6 Mar 2015, at 4:37, Tami Williams <[log in to unmask]> wrote:
> 
> FUNCTION:
> nbrList ( items ; counter ; result )
> 
> CALL:
> nbrList( "firstName¶lastName¶zip" ; "" ; "" )
> 
> 
> I'm looking for a way (if possible) to improve it so that instead I can call it without the placeholders, like this:
> 
> 
> nbrList( "firstName¶lastName¶zip")
> 
> 
> and get the same result:
> 
> 1. firstName
> 2. lastName
> 3. zip
> 
> 
> All suggestions welcome. Thanks in advance.
> 
> 
> 
> /*
> 
> // nbrList ( items ; counter ; result )
> // Recursively loops thru the elements in a return-delimited list and adds the order number to each element.
> 
> Sample Input:
> nbrList( "firstName¶lastName¶zip" ; "" ; "" )
> 
> NOTE: Do NOT enter any values for the "counter" and "result" parameters - only enter empty string (""); those parameters exist solely as placeholders for the tail recursion.
> 
> Sample Output:
> 1. firstName
> 2. lastName
> 3. zip
> 
> Description:
> This function will recursively loop thru the elements in a return-delimited list adding the order number to each element.
> 
> Author:
> Tami Williams
> www.asktami.com
> [log in to unmask]
> 
> */
> 
> 
> Let ( [
> counter = Case( counter = 0 or counter = "" ; 1 ; counter ) ;
> thisItem = GetValue ( items ; 1 ) ;
> output =  counter & ". " & thisItem
> ] ;
> 
> 
> Case ( ValueCount ( items ) > 0 ;
> 
> // loop thru each value in the valueList
>   InputsHtml ( RightValues ( items ; ValueCount ( items ) - 1 ) ;   counter + 1 ;    result  &  If ( IsEmpty(result) ; "" ; "¶" ) &  output   ) ;
> 
> // return the result
>   result 
> 
> )
> 
> )
> 
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "It's better to burn out than to fade away."
> 
> Tami Williams
> Creative Computing
> Let us help you make frustrating, costly, and inefficient processes more efficient, less costly and scalable.
> Lasso, MySQL and FileMaker specialists.
> 
> Tel/Fax: 770.457.3221
> E-Mail: [log in to unmask]
> Web: http://www.asktami.com/
> LinkedIn: http://www.linkedin.com/in/asktami
> Twitter: http://twitter.com/asktami
> iChat/AIM/Skype: tamiwilliamsusa
> 
> FileMaker Business Alliance Member | Lasso Professional Alliance Member | Certified Lasso Developer | FileMaker 11, 12 & 13 Certified Developer
> 
> ------
> 
> If you want to receive sporadic email from Creative Computing regarding news at the company and announcements about upcoming Lasso webinars and online classes, please opt-in at http://tinyurl.com/yj7eqlg

ATOM RSS1 RSS2