Brian Dunning's FileMaker Custom Functions

cfStackAppendSlide ( pInput ; pVariableName ; pStackDepth )

Append a new entry to a stack (global var) _and_ delete first entry if count of values exceeds stack depth.

  Average rating: 4.5 (38 votes) Log in to vote

Tammo Fornalik / Felix Hausberner   Tammo Fornalik / Felix Hausberner
dbyte solutions
http://www.dbyte-solutions.com

Share on Facebook Share on Twitter

  Sample input:
1. Number of Entries ≤ 3
cfStackAppendSlide( "Edward Berger"; "$$Films_StoredSearchterms"; 3 )

2. Number of Entries > 3
cfStackAppendSlide( "Edgar Berger"; "$$Films_StoredSearchterms"; 3 )
  Sample output:
1.
Multiline adventures [line 1]...
Multiline adventures [line 2]
Heavy searches
Edward Berger

2.
[note: deletes entry number 1 if number of entries exceeds 3]:

Heavy searches
Edward Berger
Edgar Berger

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

call: cfStackAppendSlide( "Edward Berger"; "$$Films_StoredSearchterms"; 5 ) or
call: cfStackAppendSlide( "Edward Berger"; "Films_StoredSearchterms"; 5 ) .
this will append the string "Edward Berger" as a new entry of stack "$$Films_StoredSearchterms".
if the stack contains less than 5 entries, "Edward Berger" will become the last entry of the stack and that's all.
if the stack already contains 5 entries, the 1st entry will be deleted while the 2nd becomes 1st,
3rd becomes 2nd, 4th becomes 3rd, 5th becomes 4th and the new 5th becomes "Edward Berger".
return: complete stack.

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: