Search Project Mgmt
Search FileMaker Blogs
FileMaker Blog

Thank you for visiting the FileMaker Calculations Explored blog. I recently moved this content over from my blogger account. Hope you like it! When you get a chance, check out the centralized search feature for all the FileMaker blogs found along the right side panel. It is quite handy!

Friday
Mar142008

FILEMAKER: The GetNextSerialValue Function

From Dwayne Wright
Certified FileMaker 9 Developer
www.dwaynewright.com
info@dwaynewright.com

GetNextSerialValue
GetNextSerialValue( fileName ; fieldName)
All Current Versions Of FileMaker
Returns A Text Result

As you know, you can have a field auto enter a serialized value when a new record is created. The GetNextSerialValue function will know what that next serial value will be, without creating the record.

The function does have the two parameters of filename and fieldname. It is not a bad idea to specify the table occurrence as a prefix to the field name. So you would be looking at something like TableOccName::FieldName. If you don't specify the table occurrence you are going to want to use, FileMaker assumes that you want the table occurrence that is linked to the layout on the current active window.

FYI ... You cannot specify a table, you have to specify a table occurrence. In fact, you can specify any table occurrence that used the table you want. This is because all the fields are exactly the same with table occurrences that use the same base table. This will likely not be a problem for those that embrace the Anchor/Buoy relationship design method.

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.

Thursday
Mar132008

FILEMAKER: The FieldType Function

From Dwayne Wright
Certified FileMaker 9 Developer
www.dwaynewright.com
info@dwaynewright.com

FieldType
FieldType( fileName ; fieldName)
All Current Versions Of FileMaker
Returns A Text Result

The FieldType design function is used to a return information about a field that you might find in the Define Fields dialog box. This is one of those design functions that returns multiple pieces of information separated by a space character. In the case of the field type function, it will return four different pieces of information. So it looks something like,

this field has
aboutThis1 (space) aboutThis2 (space) aboutThis3 (space) aboutThis4

aboutThis1 - tells you something about the storage of the field such as if it is a global, summary, unstored calculation, stored calculation or just regular.

aboutThis2 - tells you the type of field such as text, number, date, time, timestamp or container. It does not tell you if the field is a calculation field because that is told you in aboutThis1. However, it will tell you if the calculation result itself is set to text, number, date, time, timestamp or container.

aboutThis3 - is about indexing and returns that it is not indexed (unindexed) or is indeed indexed.

aboutThis4 - returns the number of repetitions for the field evaluated.

FYI...
The fieldname parameter has to have the name of the field entered in within quote marks.

So here are some examples I pulled right from my article database...
FieldType ( Get ( FileName ) ; "Blog" )
Standard Text Indexed 1

FieldType ( Get ( FileName ) ; "Blog Title Calc" )
StoredCalc Text Unindexed 1

FieldType ( Get ( FileName ) ; "g_examplehypertextcalc" )
UnstoredCalc Text Unindexed 1

FieldType ( Get ( FileName ) ; "blog_IMAGES::linked images" )
Standard Container Unindexed 10

In the last example, I’m looking at a related field. So I need to add the name of the related table occurrence in the parameter "blog_IMAGES::linked images".

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.

Wednesday
Mar122008

FILEMAKER: The FieldStyle Function

From Dwayne Wright
Certified FileMaker 9 Developer
www.dwaynewright.com
info@dwaynewright.com

FieldStyle
FieldStyle ( fileName ; layoutName ; fieldName)
All Current Versions Of FileMaker
Returns A Text Result

As you know, you can have a field on a layout linked to a value list and a field format option. So a field can be setup to have a yes / no answer. The FieldStyle function will tell you if a field is setup as ...

a standard field (Standard),
with a scroll bar (Scrolling),
with a pop up list (Popuplist),
with a pop up menu (Popupmenu),
as a series of check boxes (Checkbox),
as a radio button selection (Radiobutton) or
as a pop up calendar (Calendar).

It will also tell you the name of the value list associated to that field on that layout.

EXAMPLE: You might see the following about a pop up menu field that uses a value list of Even Numbers ( Popupmenu Even Numbers )

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.

Tuesday
Mar112008

FILEMAKER: The FieldRepetitions Function

From Dwayne Wright PMP - Certified FileMaker Developer
WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

FieldRepetitions
FieldRepetitions( fileName ; layoutName ; fieldName)
FMP Version: All Current Versions Of FileMaker
Returns A Text Result

The FieldRepetitions function gives you the number of repetitions and the orientation of a given repeating field on a layout. So if we had a repeating field using this function, we would see something like ( 4 horizontal ) or ( 4 vertical ). Now I do want to emphasis the importance of the layoutname parameter. Some user might make the mistake of putting in the table name, which will not work because this function is layout dependent. Also the returned result of repetitions is for the number of repetitions shown on the layout. This might be different than the overall number of repetitions available for a defined repeating field.

Basic EXAMPLE:
FieldRepetitions ( Get ( FileName ) ; Get ( LayoutName ); "repeating_field_1" )

EXPERIMENT
Now, I tried experimenting to see if I could use get function for the various parameters to have a dynamic return. That is to say, show me what the results are for the current repeating field that I have the cursor within. The calculation looks like this ...

FieldRepetitions ( Get ( FileName ) ; Get ( LayoutName ) ; Get ( ActiveFieldName ) )

I did get this to work using the Data Viewer in FileMaker Advanced but not as a standard calculation field. However, I do think using the Data Viewer or as a branching indicator in a script would be the more traditional use of this design function.

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.

Monday
Mar102008

FILEMAKER: The FieldNames Function

From Dwayne Wright
www.dwaynewright.com
info@dwaynewright.com

FieldNames
FieldNames( fileName ; layoutName or tableName)
FMP Version: All current versions of FileMaker
Returns A Text Result

The FieldNames function gives you the name for each field on a specified layout or in a specified table. Each field name is listed on a row by itself ( in other words carriage return delimited ).

A somewhat odd and hidden feature is the ability to substitute the name of a relationship table occurrences for the name of the layout. In cases like this, FileMaker will supply you the fields in the TO.

EXAMPLE: FieldNames ( Get ( FileName ) ; Get ( LayoutName ) )
Here is a calculation that will return all the current fields on the current layout. It uses a get functions as the parameter settings for what file and layout you want. ( fyi ... make sure you have the result unstored ) The order in which the fields appear will correspond to the order in which the fields appear in the layer of each layout.

Layout Layers

EXAMPLE: FieldNames ( Get ( FileName ) ; Get ( LayoutTableName ) )
Here is a calculation that will return all the current fields for the current table that current layout is using. It uses a get functions as the parameter settings for what file and layout you want. ( fyi ... make sure you have the result unstored ) The order in which the fields appear will correspond to the order in which the fields were created.

© 2010 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. FileMaker Pro is the registered trademark of FileMaker Inc.