Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

DQ_New ( initialContents )

Rate this function:  

  Average rating: 4.5  (26 votes)
  Discuss this Custom Function

Stephen Hanna, Stephen J. Hanna Consulting

Creates a double-ended queue (DeQue)

Sample Input:
DQ_New( List( "apple" ; "pear" ) )
Sample Output:

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.


This is a "constructor" function for a package that implements a double-ended queue (DeQue, sometimes pronounced "deck"). DeQues can be used to implement Stacks (LIFO), Queues (FIFO), or more general data structures. Five operations are defined on DeQues: Push and Pop, which add and remove items from the front (top) of the DeQue (thus causing it to behave like a stack); Put and Pull, which add and remove items from the end (bottom) of the DeQue (so Push and Pull are the basic FIFO queue operators); and Count, which returns the number of items in the DeQue.

These functions implement DeQues as global variables, but you don't need to know this or the names of the created variables. DQ_New returns the name of the variable it creates, and all the other manipulation functions accept this name as their first (or only) parameter. Thus, a typical usage sequence would be:

Set Variable [ "$myStack" ; DQ_New ( "apple" ) ) ]
Set Variable [ "$dummy" ; DQ_Push ( $myStack ; "banana" ) ]
Set Variable [ "$dummy" ; DQ_Put ( $myStack ; "cherry" ) ]
Set Variable [ "$myCount" ; DQ_Count ( $myStack ) ] // $myCount = 3
Set Variable [ "$fruit" ; DQ_Pull ( $myStack ) ] // $fruit = "cherry"
Set Variable [ "$fruit" ; DQ_Pop ( $myStack ) ] // $fruit = "banana"
Set Variable [ "$myCount" ; DQ_Count ( $myStack ) ] // $myCount = 1

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

This is my Custom Function and I want to edit it


Not one of your function definitions is is valid.

For instance you describe a function DQ_New ( initialContents )

But in fact the function definition does not contain a parameter "initialContents"

Bruce Robertson, Redmond WA
March 28, 2013 9:55pm

All of the functions are valid (at least to FileMaker), although I grant that there is a discrepancy between the names I used for the parameters in the description and the names used in the functions themselves. The parameter names used in the function are arbitrary, as long as they conform to FileMaker variable-naming rules. However, I have changed the name of the parameter in DQ_New() to match the description.

Stephen Hanna, Cupertino
March 28, 2013 11:26pm

You should do the same thing (correct the param names) for the other functions.

I also note that trying to use the data viewer to experiment with any of these functions results in a rapid accumulation of new instances of global variables.

Bruce Robertson, Redmond WA
March 29, 2013 12:46am

On the comment about global variables: Yes, that's true, because that's how the routines store the data structures. In normal use, you'd create one new structure, and hence one global variable, for each data structure you want to use. You'd then use the other functions (Push and Pop if you want to treat it as a stack, Push and Pull if you want a queue) to manipulate those structures. The idea is that you don't have to know what variables are being created behind the scenes -- just store the name that DQ_New returns to you in your own variable (or field), and pass that to the subsequent routines. [Note, by the way, that there are a total of six routines, only four of which have been posted so far: Pop and Pull are still awaiting approval.]

Stephen Hanna, Cupertino
March 29, 2013 2:10am

You list DQ_Pull and DQ_Pop which are a great complement to the set but I don't see them available.
Can you add them to the LIST so that they also can be downloaded?

Darrel, Portland
June 12, 2018 7:37am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 8 + 6 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions