Skip to content

FDR Reference

Constructor

The fdrs object can contain multiple instances of the FDR class. TheM.fdrs['PUT_FDR_Name_HERE'] refers to the value of the flexible data record with the given name, if it exists. The FDR value may be of any type (number, string, boolean, array, object, etc.) Whatever is stored in the flexible data record is stored locally and synced with the server. There is a 500 ms wait before the server sync occurs in order to pool changes and avoid multiple calls when several FDRs are modified at once. Some FDRs received from the server are read-only and cannot be altered. FDRs can be used as persistent storage synchronized across all of the user's devices.

A new instance of the FDR class is initialized when a modelBank fdr pushed or modelBank FDR pushed event occurs. A new FDR instance can also be created using the TheM.fdrs.doPrepare method. The value of the FDR class can be referenced like TheM.fdrs['PUT_FDR_Name_HERE'].

//A new instance of the FDR class is instantiated automatically when a new fdr is added via a TheM.fdrs.doPrepare() call.

const newFDR = TheM.fdrs.doPrepare('NAME_OF_FDR_TO_ADD', ANY_VALUE);

Example

const newStringFDR = TheM.fdrs.doPrepare('stringFDR', 'This is a string');
const newNumberFDR = TheM.fdrs.doPrepare('numberFDR', 42);
const newBooleanFDR = TheM.fdrs.doPrepare('booleanFDR', true);
const newArrayFDR = TheM.fdrs.doPrepare('arrayFDR', ['This', 'is', 'an', 'array', true, 42]);
const newObjectFDR = TheM.fdrs.doPrepare('objectFDR', { prop1: 'something' });
console.log(newObjectFDR.value.prop1); //'something'
console.log(TheM.fdrs['objectFDR']); //{ prop1: 'something' }

Properties

Property table for FDR

Property Description Required Schema
value Gets (returns) the value stored in this flexible data record. Yes {
  "title": "value",
  "type": "any",
  "description": "Gets (returns) the value stored in
this flexible data record.",
  "examples": [
    {
      "prop1": "something"
    }
  ],
  "nullable": false
}
toJSON Gets (returns) the FDR properties in a JSON formatted object. Yes {
  "title": "toJSON",
  "type": "object",
  "description": "Gets (returns) the FDR properties
in a JSON formatted object.",
  "examples": [
    {
      "dtsModified": "Sat Oct 14 1978 20:00:00 GMT-0400
(Eastern Daylight Time)",
      "isModified": true,
      "name": "objectFDR",
      "value": {
        "prop1": "something"
      }
    }
  ],
  "nullable": false
}
dtsModified Gets (returns) the date that the FDR record was last modified in ampliFi. Yes {
  "title": "TheM.fdrs[0].dtsModified",
  "type": "Date",
  "nullable": false,
  "description": "Gets (returns) the date that the
FDR record was last modified in ampliFi.",
  "examples": [
    "Mon Jul 22 2024 10:50:45 GMT-0400 (Eastern
Daylight Time)"
  ]
}