eLabSDK.StorageLayer

Functions

NameDescription
getPositionName(locationParams, callback)Get a human-readable position name for a storage location.

This converts storage location parameters into a friendly, readable position name (e.g.,
"Box 3, Row A, Column 5"). The API translates the numeric position parameters into a
formatted string suitable for display to users. Use this to display storage locations in
human-readable format rather than raw coordinates or IDs. The position name is returned
asynchronously via callback.
linkBarcodeToStorageLayer(storageLayerID, barcode, callback, [onError]) | Associate a barcode with a storage layer for quick identification.

This links a barcode (alternative ID) to the specified storage layer, enabling barcode-based
identification and access to the storage location. After linking, users can scan the barcode
to quickly navigate to or identify the storage layer. The operation is asynchronous and
executes callbacks for success and error cases. Use this to enable barcode scanning workflows
for storage location management or to integrate with barcode labeling systems.

getPositionName(locationParams, callback)

Get a human-readable position name for a storage location.

This converts storage location parameters into a friendly, readable position name (e.g.,
"Box 3, Row A, Column 5"). The API translates the numeric position parameters into a
formatted string suitable for display to users. Use this to display storage locations in
human-readable format rather than raw coordinates or IDs. The position name is returned
asynchronously via callback.

Kind: global function

ParamTypeDescription
locationParamsstringURL-encoded position parameters (e.g., "layerID=123&row=2&col=5")
callbackfunctionCallback function executed with the position name
callback.positionNamestringThe human-readable position name

Example

// Get friendly name for storage position
eLabSDK.ready(function() {
  var storageLayer = new eLabSDK.StorageLayer();
  var params = 'layerID=123&row=2&col=5';
  
  storageLayer.getPositionName(params, function(positionName) {
    console.log('Position: ' + positionName);
    // Output: "Box 3, Row B, Column 5"
    $('#storageLocation').text(positionName);
  });
});

Example

// Display sample location in readable format
eLabSDK.ready(function() {
  var storageLayer = new eLabSDK.StorageLayer();
  
  eLabSDK.Inventory.Sample.load(456, function(sample) {
    var locationParams = 'layerID=' + sample.storageLayerID + 
                         '&row=' + sample.row + 
                         '&col=' + sample.column;
    
    storageLayer.getPositionName(locationParams, function(positionName) {
      alert('Sample is stored at: ' + positionName);
    });
  });
});

Example

// Build position display for multiple samples
eLabSDK.ready(function() {
  var storageLayer = new eLabSDK.StorageLayer();
  var samples = getSampleArray(); // array of sample objects
  
  samples.forEach(function(sample) {
    var params = 'layerID=' + sample.storageLayerID + 
                 '&position=' + sample.position;
    
    storageLayer.getPositionName(params, function(positionName) {
      console.log(sample.name + ' -> ' + positionName);
      displaySampleLocation(sample.sampleID, positionName);
    });
  });
});

linkBarcodeToStorageLayer(storageLayerID, barcode, callback, [onError])

Associate a barcode with a storage layer for quick identification.

This links a barcode (alternative ID) to the specified storage layer, enabling barcode-based
identification and access to the storage location. After linking, users can scan the barcode
to quickly navigate to or identify the storage layer. The operation is asynchronous and
executes callbacks for success and error cases. Use this to enable barcode scanning workflows
for storage location management or to integrate with barcode labeling systems.

Kind: global function

ParamTypeDescription
storageLayerIDnumberThe numeric ID of the storage layer to link the barcode to
barcodestringThe barcode string to associate with the storage layer
callbackfunctionCallback function executed on successful barcode linking
callback.storageLayerIDnumberThe storage layer ID that was linked
[onError]functionOptional callback function executed if linking fails

Example

// Link barcode to storage layer
eLabSDK.ready(function() {
  var storageLayer = new eLabSDK.StorageLayer();
  var layerID = 123;
  var barcode = 'STR-BOX-001';
  
  storageLayer.linkBarcodeToStorageLayer(
    layerID,
    barcode,
    function(linkedLayerID) {
      console.log('Barcode linked to storage layer: ' + linkedLayerID);
      alert('Barcode ' + barcode + ' successfully linked');
    },
    function(error) {
      console.error('Failed to link barcode:', error);
      alert('Error: Could not link barcode');
    }
  );
});

Example

// Link barcode after printing label
eLabSDK.ready(function() {
  var storageLayer = new eLabSDK.StorageLayer();
  
  function printAndLinkLabel(storageLayerID) {
    // Generate barcode
    var newBarcode = 'SL-' + storageLayerID + '-' + Date.now();
    
    // Print label
    eLabSDK.Label.print({
      type: 'storageLayer',
      barcode: newBarcode,
      layerID: storageLayerID
    });
    
    // Link barcode to layer
    storageLayer.linkBarcodeToStorageLayer(
      storageLayerID,
      newBarcode,
      function() {
        console.log('Label printed and barcode linked');
      }
    );
  }
  
  printAndLinkLabel(456);
});

Example

// Interactive barcode assignment
eLabSDK.ready(function() {
  var storageLayer = new eLabSDK.StorageLayer();
  
  $('#assignBarcodeBtn').on('click', function() {
    var layerID = parseInt($('#storageLayerID').val());
    var barcode = prompt('Enter barcode for this storage layer:');
    
    if (barcode) {
      storageLayer.linkBarcodeToStorageLayer(
        layerID,
        barcode,
        function(linkedID) {
          $('#barcodeStatus').text('✓ Barcode linked: ' + barcode);
          console.log('Successfully linked to layer: ' + linkedID);
        },
        function(error) {
          $('#barcodeStatus').text('✗ Error linking barcode');
          console.error(error);
        }
      );
    }
  });
});

© 2023 eLabNext