FileMakerLayout
in package
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
Table of Contents
Methods
- create() : int
- Create a record on the target layout of the FileMaker database.
- delete() : mixed
- Delete on record.
- duplicate() : mixed
- Duplicate record.
- endCommunication() : mixed
- 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
- Get metadata information of the layout.
- getMetadataOld() : object
- 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
- Get the script error code.
- getScriptErrorPrerequest() : int
- Get the prerequest script error code.
- getScriptErrorPresort() : int
- Get the presort script error code.
- getScriptResult() : string
- Get the return value from the script.
- getScriptResultPrerequest() : string
- Get the return value from the prerequest script.
- getScriptResultPresort() : string
- Get the return value from the presort script.
- query() : FileMakerRelation|null
- Query to the FileMaker Database and returns the result as FileMakerRelation object.
- setGlobalField() : mixed
- Set the value to the global field.
- startCommunication() : mixed
- Start a transaction which is a serial calling of any database operations, and login with the target layout.
- update() : mixed
- Update fields in one record.
- uploadFile() : mixed
- 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> $data = null ][, array<string|int, mixed> $portal = null ][, array<string|int, mixed> $script = null ]) : int
Parameters
- $data : array<string|int, mixed> = null
-
Associated array contains the initial values. Keys are field names and values is these initial values.
- $portal : array<string|int, mixed> = null
-
Associated array contains the modifying values in portal. Ex.: {"<PortalName>"=>{"<FieldName>"=>"<Value>"...}}. FieldName has to "<TOCName>::<FieldName>".
- $script : array<string|int, mixed> = null
-
scripts that should execute right timings. See FileMakerRelation::query().
Tags
Return values
int —The recordId of created record. If the returned value is an integer larger than 0, it shows one record was created.
delete()
Delete on record.
public
delete(int $recordId[, array<string|int, mixed> $script = null ]) : mixed
Parameters
- $recordId : int
-
The valid recordId value to delete.
- $script : array<string|int, mixed> = null
-
scripts that should execute right timings. See FileMakerRelation::query().
Tags
duplicate()
Duplicate record.
public
duplicate(int $recordId[, array<string|int, mixed> $script = null ]) : mixed
Parameters
- $recordId : int
-
The valid recordId value to duplicate.
- $script : array<string|int, mixed> = null
-
scripts that should execute right timings. See FileMakerRelation::query().
Tags
endCommunication()
Finish a transaction which is a serial calling of any database operations, and logout.
public
endCommunication() : mixed
getDebugInfo()
Get debug information includes internal request URL and request body.
public
getDebugInfo() : string
Return values
stringgetMetadata()
Get metadata information of the layout.
public
getMetadata() : object
Tags
Return values
object —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
Tags
Return values
object —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 $recordId[, array<string|int, mixed> $portal = null ][, array<string|int, mixed> $script = null ]) : FileMakerRelation|null
Parameters
- $recordId : int
-
The recordId.
- $portal : array<string|int, mixed> = null
-
See the query() method's same parameter.
- $script : array<string|int, mixed> = null
-
scripts that should execute right timings. See FileMakerRelation::query().
Tags
Return values
FileMakerRelation|null —Query result.
getScriptError()
Get the script error code.
public
getScriptError() : int
Return values
int —The value of the error code. If any script wasn't called, returns null.
getScriptErrorPrerequest()
Get the prerequest script error code.
public
getScriptErrorPrerequest() : int
Return values
int —The value of the error code. If any script wasn't called, returns null.
getScriptErrorPresort()
Get the presort script error code.
public
getScriptErrorPresort() : int
Return values
int —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
Return values
string —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
Return values
string —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
Return values
string —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> $condition = null ][, array<string|int, mixed> $sort = null ][, int $offset = 0 ][, int $range = 0 ][, array<string|int, mixed> $portal = null ][, array<string|int, mixed> $script = null ]) : FileMakerRelation|null
Parameters
- $condition : array<string|int, mixed> = 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 records 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
-
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
-
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 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
-
scripts that should execute 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 it's three elements, these are "script", "script.param" and "layout.response." If it it's four elements, these are "script.prerequest", "script.presort", "script" and "layout.response."
Tags
Return values
FileMakerRelation|null —Query result.
setGlobalField()
Set the value to the global field.
public
setGlobalField(array<string|int, mixed> $fields) : mixed
Parameters
- $fields : array<string|int, mixed>
-
Associated array contains the global field names and its values. Keys are global field names and values is these values.
Tags
startCommunication()
Start a transaction which is a serial calling of any database operations, and login with the target layout.
public
startCommunication() : mixed
update()
Update fields in one record.
public
update(int $recordId, array<string|int, mixed> $data[, int $modId = -1 ][, array<string|int, mixed> $portal = null ][, array<string|int, mixed> $script = null ]) : mixed
Parameters
- $recordId : int
-
The valid recordId value to update.
- $data : array<string|int, mixed>
-
Associated array contains the modifying values. Keys are field names and values is these initial values.
- $modId : int = -1
-
The modId to allow to update. 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
-
Associated array contains the modifying values in 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
-
scripts that should execute right timings. See FileMakerRelation::query().
Tags
uploadFile()
Upload the file into container filed.
public
uploadFile(string $filePath, int $recordId, string $containerFieldName[, int $containerFieldRepetition = null ][, string $fileName = null ]) : mixed
Parameters
- $filePath : string
-
The file path to upload.
- $recordId : int
-
The Record Id of the record.
- $containerFieldName : string
-
The field name of container field.
- $containerFieldRepetition : int = null
-
In 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
-
Another file name for uploading file. If omitted, origina file name is choosen.