Documentation

FileMakerLayout

Class FileMakerLayout is the proxy of layout in FileMaker database.

The object of this class is going to be generated by the FMDataAPI class, and you shouldn't call the constructor of this class.

Tags
link

GitHub Repository

version
31
author

Masayuki Nii nii@msyk.net

copyright

2017-2024 Masayuki Nii (Claris FileMaker is registered trademarks of Claris International Inc. in the U.S. and other countries.)

Table of Contents

Methods

create()  : int|null
Create a record on the target layout of the FileMaker database.
delete()  : void
Delete the record.
duplicate()  : void
Duplicate the record.
endCommunication()  : void
Finish a transaction which is a serial calling of any database operations, and logout.
getDebugInfo()  : string
Get debug information includes internal request URL and request body.
getMetadata()  : object|null|bool
Get metadata information of the layout.
getMetadataOld()  : object|null|bool
Get the metadata information of the layout. Until ver.16 this method was 'getMetadata'.
getRecord()  : FileMakerRelation|null
Query to the FileMaker Database with recordId special field and returns the result as FileMakerRelation object.
getScriptError()  : int|null
Get the script error code.
getScriptErrorPrerequest()  : int|null
Get the prerequest script error code.
getScriptErrorPresort()  : int|null
Get the presort script error code.
getScriptResult()  : string|null
Get the return value from the script.
getScriptResultPrerequest()  : string|null
Get the return value from the prerequest script.
getScriptResultPresort()  : string|null
Get the return value from the presort script.
query()  : FileMakerRelation|null
Query to the FileMaker Database and returns the result as FileMakerRelation object.
setGlobalField()  : void
Set the value to the global field.
startCommunication()  : void
Start a transaction which is a serial calling of any database operations, and login with the target layout.
update()  : void
Update fields in one record.
uploadFile()  : void
Upload the file into container filed.

Methods

create()

Create a record on the target layout of the FileMaker database.

public create([array<string|int, mixed>|null $data = null ][, array<string|int, mixed>|null $portal = null ][, array<string|int, mixed>|null $script = null ]) : int|null
Parameters
$data : array<string|int, mixed>|null = null

Associated array contains the initial values. Keys are field names and values is these initial values.

$portal : array<string|int, mixed>|null = null

Associated array contains the modifying values in the portal. Ex.: {"<PortalName>"=>{"<FieldName>"=>"<Value>"...}}. FieldName has to "<TOCName>::<FieldName>".

$script : array<string|int, mixed>|null = null

scripts that should execute the right timings. See FileMakerRelation::query().

Tags
throws
Exception

In case of any error, an exception arises.

Return values
int|null

The recordId of created record. If the returned value is an integer larger than 0, it shows one record was created.

delete()

Delete the record.

public delete(int|null $recordId[, array<string|int, mixed>|null $script = null ]) : void
Parameters
$recordId : int|null

The valid recordId value to delete.

$script : array<string|int, mixed>|null = null

scripts that should execute the right timings. See FileMakerRelation::query().

Tags
throws
Exception

In case of any error, an exception arises.

duplicate()

Duplicate the record.

public duplicate(int|null $recordId[, array<string|int, mixed>|null $script = null ]) : void
Parameters
$recordId : int|null

The valid recordId value to duplicate.

$script : array<string|int, mixed>|null = null

scripts that should execute the right timings. See FileMakerRelation::query().

Tags
throws
Exception

In case of any error, an exception arises.

endCommunication()

Finish a transaction which is a serial calling of any database operations, and logout.

public endCommunication() : void
Tags
throws
Exception

getDebugInfo()

Get debug information includes internal request URL and request body.

public getDebugInfo() : string
Return values
string

getMetadata()

Get metadata information of the layout.

public getMetadata() : object|null|bool
Tags
throws
Exception

In case of any error, an exception arises.

Return values
object|null|bool

The metadata information of the layout. It has 3 properties 'fieldMetaData', 'portalMetaData' and 'valueLists'. The later one has properties having portal object name of TO name. The array of the field information is set under 'fieldMetaData' and the portal named properties. Ex.: {"fieldMetaData": [{"name": "id","type": "normal","displayType": "editText","result": "number","global": false, "autoEnter": true,"fourDigitYear": false,"maxRepeat": 1,"maxCharacters": 0,"notEmpty": false,"numeric": false, "timeOfDay": false,"repetitionStart": 1,"repetitionEnd": 1},....,],"portalMetaData": {"Contact": [{ "name": "contact_to::id","type": "normal",...},...], "history_to": [{"name": "history_to::id","type": "normal", ...}...]}

getMetadataOld()

Get the metadata information of the layout. Until ver.16 this method was 'getMetadata'.

public getMetadataOld() : object|null|bool
Tags
throws
Exception

In case of any error, an exception arises.

Return values
object|null|bool

The metadata information of the layout. It has just 1 property 'metaData' the array of the field information is set under the 'metaData' property. There is no information about portals. Ex.: {"metaData": [{"name": "id","type": "normal","result": "number","global": "false","repetitions": 1,"id": "1"}, {"name": "name","type": "normal","result": "text","global": "false","repetitions": 1,"id": "2"},....,]}

getRecord()

Query to the FileMaker Database with recordId special field and returns the result as FileMakerRelation object.

public getRecord(int|null $recordId[, array<string|int, mixed>|null $portal = null ][, array<string|int, mixed>|null $script = null ]) : FileMakerRelation|null
Parameters
$recordId : int|null

The recordId.

$portal : array<string|int, mixed>|null = null

See the query() method's same parameter.

$script : array<string|int, mixed>|null = null

scripts that should execute the right timings. See FileMakerRelation::query().

Tags
throws
Exception

In case of any error, an exception arises.

Return values
FileMakerRelation|null

Query result.

getScriptError()

Get the script error code.

public getScriptError() : int|null
Return values
int|null

The value of the error code. If any script wasn't called, returns null.

getScriptErrorPrerequest()

Get the prerequest script error code.

public getScriptErrorPrerequest() : int|null
Return values
int|null

The value of the error code. If any script wasn't called, returns null.

getScriptErrorPresort()

Get the presort script error code.

public getScriptErrorPresort() : int|null
Return values
int|null

The value of the error code. If any script wasn't called, returns null.

getScriptResult()

Get the return value from the script.

public getScriptResult() : string|null
Return values
string|null

The return value from the script. If any script wasn't called, returns null.

getScriptResultPrerequest()

Get the return value from the prerequest script.

public getScriptResultPrerequest() : string|null
Return values
string|null

The return value from the prerequest script. If any script wasn't called, returns null.

getScriptResultPresort()

Get the return value from the presort script.

public getScriptResultPresort() : string|null
Return values
string|null

The return value from the presort script. If any script wasn't called, returns null.

query()

Query to the FileMaker Database and returns the result as FileMakerRelation object.

public query([array<string|int, mixed>|null $condition = null ][, array<string|int, mixed>|null $sort = null ][, int $offset = 0 ][, int $range = 0 ][, array<string|int, mixed>|null $portal = null ][, array<string|int, mixed>|null $script = null ]) : FileMakerRelation|null
Parameters
$condition : array<string|int, mixed>|null = null

The array of associated array which has a field name and "omit" keys as like: array(array("FamilyName"=>"Nii*", "Country"=>"Japan")). In this example of apply the AND operation for two fields, and "FamilyName" and "Country" are field name. The value can contain the operator: =, ==, !, <, ≤ or <=, >, ≥ or >=, ..., //, ?, @, #, , , "", ~. If you want to apply the OR operation, describe array of array as like: array(array("FamilyName"=>"Nii"), array("Country"=>"Japan")). If you want to omit record match with condition set the "omit" element as like: array("FamilyName"=>"Nii*", "omit"=>"true"). If you want to query all records in the layout, set the first parameter to null.

$sort : array<string|int, mixed>|null = null

The array of array which has 2 elements as a field name and order key: array(array("FamilyName", "ascend"), array("GivenName", "descend")). The value of order key can be 'ascend', 'descend' or value list name. The default value is 'ascend'.

$offset : int = 0

The start number of the record set, and the first record is 1, but the number 0 queries from the first record. The default value is 0.

$range : int = 0

The number of records contains in the result record set. The default value is 100.

$portal : array<string|int, mixed>|null = null

The array of the portal's object names. The query result is going to contain portals specified in this parameter. If you want to include all portals, set it null or omit it. Simple case is array('portal1', portal2'), and just includes two portals named 'portal1' and 'portal2' in the query result. If you set the range of records to a portal, you have to build an associated array as like: array('portal1' => array('offset'=>1,'limit'=>5), 'portal2' => null). The record 1 to 5 of portal1 include the query result, and also all records in portal2 do.

$script : array<string|int, mixed>|null = null

scripts that should execute the right timings. The most understandable description is an associated array with API's keywords "script", "script.param", "script.prerequest", "script.prerequest.param", "script.presort", "script.presort.param", "layout.response." These keywords have to be a key, and the value is script name or script parameter, ex. {"script"=>"StartingOver", "script.param"=>"344|21|abcd"}. If $script is array with one element, it's handled as the value of "script." If $script is array with two elements, these are handled as values of "script" and "layout.response." If it's three elements, these are "script", "script.param" and "layout.response." If it's four elements, these are "script.prerequest", "script.presort", "script" and "layout.response."

Tags
throws
Exception

In case of any error, an exception arises.

Return values
FileMakerRelation|null

Query result.

setGlobalField()

Set the value to the global field.

public setGlobalField(array<string|int, mixed> $fields) : void
Parameters
$fields : array<string|int, mixed>

The Associated array contains the global field names and its values. Keys are global field names and values is these values.

Tags
throws
Exception

In case of any error, an exception arises.

startCommunication()

Start a transaction which is a serial calling of any database operations, and login with the target layout.

public startCommunication() : void
Tags
throws
Exception

update()

Update fields in one record.

public update(int|null $recordId, array<string|int, mixed>|null $data[, int $modId = -1 ][, array<string|int, mixed>|null $portal = null ][, array<string|int, mixed>|null $script = null ]) : void
Parameters
$recordId : int|null

The valid recordId value to update.

$data : array<string|int, mixed>|null

Associated array contains the modifying values. Keys are field names and values is these initial values.

$modId : int = -1

The modId to allow updating. This parameter is for detect to modifying other users. If you omit this parameter, update operation does not care the value of modId special field.

$portal : array<string|int, mixed>|null = null

Associated array contains the modifying values in the portal. Ex.: {"<PortalName>"=>{"<FieldName>"=>"<Value>", "recordId"=>"12"}}. FieldName has to "<TOCName>::<FieldName>". The recordId key specifiy the record to edit in portal.

$script : array<string|int, mixed>|null = null

scripts that should execute the right timings. See FileMakerRelation::query().

Tags
throws
Exception

In case of any error, an exception arises.

uploadFile()

Upload the file into container filed.

public uploadFile(string $filePath, int|null $recordId, string $containerFieldName[, int|null $containerFieldRepetition = null ][, string|null $fileName = null ]) : void
Parameters
$filePath : string

The file path to upload.

$recordId : int|null

The Record ID of the record.

$containerFieldName : string

The field name of container field.

$containerFieldRepetition : int|null = null

In the case of repetiton field, this has to be the number from 1. If omitted this, the number "1" is going to be specified.

$fileName : string|null = null

Another file name for uploading file. If omitted, the original file name is chosen.

Tags
throws
Exception

In case of any error, an exception arises.


        
On this page

Search results