ShowValueCascade ( fields ; altText ) ( )

Function stats

Average user rating
234
249
9999
Support
FileMaker 7.0 +
Date posted
20 February 2010
Version
1
Recursive function
Yes

Author Info
 Chad S.

3 functions

Average Rating None

author_avatar



 

Function overview

Prototype

ShowValueCascade ( fields ; altText )  ( fields;   altText )


Parameters

fields  a quoted list of fields, parameters expressions


altText  alternate text to show if all evaluated values are empty


Description

Tags:  Text Parsing  

PURPOSE: to show the first available value from a list of fields.

SPECIAL CONSIDERATIONS: it is assumed you are pointing to fields (or parameters) and the list of fields are separated by semicolons and the whole string is encapsulated in quotes


ShowValueCascade ( "firstChoice; { secondChoice; thirdChoice; fourthChoice...}"; altText)

given the field values:
Student::FirstName = (empty)
Student::MiddleName = "Joe"
Student::NickName = "Sticky"

ShowValueCascade ( "Student::FirstName; Student::MiddleName; Student::NickName"; "The Student With No Name" ) will return "Joe" since it's first on the list

given the field values:
Student::FirstName = (empty)
Student::MiddleName = (empty)
Student::NickName = (empty)

ShowValueCascade ( "Student::FirstName; Student::MiddleName; Student::NickName"; "The Student With No Name" ) will return "The Student With No Name" all the referenced fields are empty

Examples

Sample input

ShowValueCascade ( "Student::FirstName; Student::MiddleName; Student::NickName"; "The Student With No Name" )


Sample output

Lefty

 

Function code

/*
NAME:    ShowValueCascade ( fields ; altText )
CREATORNAME:    Chad Sager, IT Solutions Consulting, Inc.
CREATOREMAIL:    chad.sager@itsolutions-inc.com
DATE CREATED:     2010-02-18
DATE LASTMODIFIED:     2010-02-18

PURPOSE: to show the first available value from a list of fields.

SPECIAL CONSIDERATIONS: it is assumed you are pointing to fields (or parameters) and the list of fields are separated by semicolons and the whole string is encapsulated in quotes

ShowValueCascade ( "firstChoice; { secondChoice; thirdChoice; fourthChoice...}"; altText)

given the field values:
Student::FirstName = (empty)
Student::MiddleName = "Joe"
Student::NickName = "Sticky"

ShowValueCascade ( "Student::FirstName; Student::MiddleName; Student::NickName"; "The Student With No Name" ) will return "Joe" since it's first on the list

given the field values:
Student::FirstName = (empty)
Student::MiddleName = (empty)
Student::NickName = (empty)

ShowValueCascade ( "Student::FirstName; Student::MiddleName; Student::NickName"; "The Student With No Name" ) will return "The Student With No Name" all the referenced fields are empty





*/



Let (
[
@length = Length ( fields );
@position = Case ( Position ( fields; ";"; 1; 1 ) > 0; Position ( fields; ";"; 1; 1 ); @length + 1 );
@firstValue = Left ( fields; @position - 1 );
@newFields = FullTrim ( Right ( fields; @length - ( @position + 1 ) ) )
];

Case (
not IsEmpty ( Evaluate ( @firstValue ) ); Evaluate ( @firstValue );
IsEmpty ( fields ); altText ;
ShowValueCascade ( @newFields ; altText )
)

)

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

    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/249

    Prototype: ShowValueCascade ( fields ; altText )( fields; altText )
    Function Author: Chad S. (http://www.fmfunctions.com/mid/234)
    Last updated: 20 February 2010
    Version: 1

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

 

 

 

 

 

 

 

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)