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: 19 February 2010
Version: 1
*/
// ===================================
/*__LITBR__NAME: ShowValueCascade ( fields ; altText )__LITBR__CREATORNAME: Chad Sager, IT Solutions Consulting, Inc.__LITBR__CREATOREMAIL: chad.sager@itsolutions-inc.com__LITBR__DATE CREATED: 2010-02-18__LITBR__DATE LASTMODIFIED: 2010-02-18__LITBR____LITBR__PURPOSE: to show the first available value from a list of fields. __LITBR____LITBR__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__LITBR____LITBR__ShowValueCascade ( "firstChoice; { secondChoice; thirdChoice; fourthChoice...}"; altText)__LITBR____LITBR__given the field values:__LITBR__Student::FirstName = (empty)__LITBR__Student::MiddleName = "Joe"__LITBR__Student::NickName = "Sticky"__LITBR____LITBR__ShowValueCascade ( "Student::FirstName; Student::MiddleName; Student::NickName"; "The Student With No Name" ) will return "Joe" since it's first on the list__LITBR____LITBR__given the field values:__LITBR__Student::FirstName = (empty)__LITBR__Student::MiddleName = (empty)__LITBR__Student::NickName = (empty)__LITBR____LITBR__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__LITBR____LITBR____LITBR____LITBR____LITBR____LITBR__*/__LITBR____LITBR____LITBR____LITBR__Let (__LITBR__[__LITBR__@length = Length ( fields );__LITBR__@position = Case ( Position ( fields; ";"; 1; 1 ) > 0; Position ( fields; ";"; 1; 1 ); @length + 1 );__LITBR__@firstValue = Left ( fields; @position - 1 );__LITBR__@newFields = FullTrim ( Right ( fields; @length - ( @position + 1 ) ) )__LITBR__];__LITBR____LITBR__Case (__LITBR__not IsEmpty ( Evaluate ( @firstValue ) ); Evaluate ( @firstValue );__LITBR__IsEmpty ( fields ); altText ;__LITBR__ShowValueCascade ( @newFields ; altText )__LITBR__)__LITBR____LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/249__LITBR____LITBR__ Prototype: ShowValueCascade ( fields ; altText )( fields; altText )__LITBR__ Function Author: Chad S. (http://www.fmfunctions.com/mid/234)__LITBR__ Last updated: 19 February 2010__LITBR__ Version: 1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.