UNPKG

node-red-contrib-filemaker

Version:

Node-RED FileMaker nodes. These nodes use the FileMaker Data API to connect with a FileMaker database.

152 lines (147 loc) 6.79 kB
<script type="text/javascript"> RED.nodes.registerType("dapi-create-record", { category: "FileMaker", defaults: { name: { value: null, required: false }, client: { value: "", type: "dapi-client" }, layout: { value: "payload.layout", required: true }, layoutType: { value: "msg" }, data: { value: "payload.data", required: false }, dataType: { value: "msg" }, scripts: { value: null, required: false }, scriptsType: { value: "none" }, merge: { value: false, required: false }, mergeType: { value: "bool" }, output: { value: "payload", required: true } }, oneditprepare: function() { var nullType = { value: "none", label: "None", icon: "", hasValue: false }; $("#node-input-layout").typedInput({ default: "str", types: ["str", "msg", "flow", "global"], typeField: $("#node-input-layoutType") }); $("#node-input-scripts").typedInput({ default: "none", types: ["json", "msg", "flow", "global", nullType], typeField: $("#node-input-scriptsType") }); $("#node-input-data").typedInput({ default: "none", types: ["json", "msg", "flow", "global", nullType], typeField: $("#node-input-dataType") }); $("#node-input-merge").typedInput({ default: "bool", types: ["bool", "msg", "flow", "global"], typeField: $("#node-input-mergeType") }); $("#node-input-output").typedInput({ default: "msg", types: ["msg"] }); }, inputs: 1, outputs: 1, paletteLabel: "Create", icon: "create.png", color: "#39D1C0", label: function() { return this.name || "Create Record"; } }); </script> <script type="text/x-red" data-template-name="dapi-create-record"> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag" aria-hidden="true"></i> <span>Name</span></label> <input type="text" id="node-input-name" placeholder="Specific Node"> </div> <hr> <div class="form-row"> <label for="node-input-client"><i class="fa fa-cogs" aria-hidden="true"></i> <span>Client</span></label> <input type="text" id="node-input-client"> </div> <div class="form-row"> <label for="node-input-layout"><i class="fa fa-list-alt" aria-hidden="true"></i> <span>Layout</span></label> <input type="hidden" id="node-input-layoutType"> <input type="text" id="node-input-layout"> </div> <hr> <div class="form-row"> <label for="node-input-layout"><i class="fa fa-align-left" aria-hidden="true"></i> <span>Data</span></label> <input type="hidden" id="node-input-dataType"> <input type="text" id="node-input-data"> </div> <div class="form-row"> <label for="node-input-scripts"><i class="fa fa-files-o" aria-hidden="true"></i> <span>Scripts</span></label> <input type="hidden" id="node-input-scriptsType"> <input type="text" id="node-input-scripts"> </div> <div class="form-row"> <label for="node-input-merge"><i class="fa fa-indent" aria-hidden="true"></i> <span>Merge Data</span></label> <input type="hidden" id="node-input-mergeType"> <input type="text" id="node-input-merge"> </div> <hr> <div class="form-row"> <label for="node-input-output"><i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i> <span>Output</span></label> <input type="text" id="node-input-output"> </div> </script> <script type="text/x-red" data-help-name="dapi-create-record"> <p> This node creates a record in FileMaker. Defaults are <code>msg.payload.layout</code> for layout context and <code>msg.payload.data</code> for setting field or portal data. </p> <h3>Inputs</h3> <dl class="message-properties"> <dt>layout<span class="property-type">String</span><dd>The layout to use when creating a record.</dd> <dt>data<span class="property-type">Object</span><dd>The field or portal data to set when creating a record.<a target="_blank" href="https://github.com/Luidog/fms-api-client#data-syntax"> More Info.</a></dd> <dt>scripts<span class="property-type">Array</span><dd>The scripts to run when creating a record.<a target="_blank" href="https://github.com/Luidog/fms-api-client#script-array-syntax"> More Info.</a></dd> <dt>merge<span class="property-type">Boolean</span><dd>Whether to merge the data parameter with the Data API response.<a target="_blank" href="https://github.com/Luidog/fms-api-client#data-merge"> More Info.</a></dd> </dl> <h3>Outputs</h3> <ol class="node-ports"> <li>Standard Output <dl class="message-properties"> <dt>recordId<span class="property-type">String</span> <dd>The record id of the created record.</dd> </dt> <dt>modId<span class="property-type">String</span> <dd>The modification id of the created record.</dd> </dt> </dl> </li> <li>Standard Error <dl class="message-properties"> <dt>message<span class="property-type">String</span> <dd>The FileMaker or Data API client error message.</dd> </dt> <dt>error<span class="property-type">String</span> <dd>The applicable FileMaker error code.</dd> </dt> </dl> </li> </ol> <h3>Details</h3> <p> This node creates a record in FileMaker. By default this node will use the value in <code>msg.payload.layout</code> as the layout context and <code>msg.payload.data</code> for setting field or portal data.<br/><br/> This node can be configured to use either static or dynamic input parameters. Dynamic parameters may be read from either the <code>msg</code> property or the <code>flow</code> and <code>global</code> contexts.<br/><br/> The default output of this node is <code>msg.payload</code>. This node can also be configured to merge its output with any property on the <code>msg</code> object. </p> <h3>References</h3> <ul> <li><a href="https://github.com/Luidog/fms-api-client#create-records">Create Method</a> - Base Client Method Documentation</li> <li><a href="https://github.com/Luidog/fms-api-client#data-syntax">Data Syntax</a> - Data Syntax Documentation</li> <li><a href="https://github.com/Luidog/fms-api-client#script-array-syntax">Scripts Array</a> - Scripts Array Documentation</li> <li><a href="https://github.com/Luidog/fms-api-client#data-merge">Data Merge</a> - Data Merge Documentation</li> <li><a href="https://github.com/Luidog/node-red-contrib-filemaker">Node-RED FileMaker</a> - The Node's Github Repository</li> <li><a href="https://github.com/Luidog/fms-api-client">Data API Client</a> - Data API Client Github Repository</li> </ul> </script>