4 min read

subtractTwoNumbers Documentation

Overview

The node is a component of the Vantage analytics and data platform that performs a subtraction operation on two numerical inputs. It is designed to take two numeric values and return their difference, facilitating numerical calculations and data processing in various analytical scenarios.

Purpose

The primary purpose of the node is to allow users to easily compute the difference between two numbers. It ensures that the inputs are valid and handles errors gracefully, making it a reliable utility for any calculations requiring subtraction.

Settings

The node has the following configurable settings:

1. input1

2. input2

Function Behavior

Data Expectations

The node expects the following data format for its operation:

Example of expected input format:

json
{
  "inputs": {
    "input1": "10",
    "input2": "5"
  }
}

Error Handling

If either input1 or input2 is not a valid number, the function will throw an error:

SubtractTwoNumbers: Both inputs must be valid numbers.

This validation ensures that the operation does not proceed with invalid data, maintaining the integrity of the results.

Use Cases & Examples

Use Cases

  1. Financial Calculation: A financial analyst needs to calculate the net profit by subtracting total expenses from total revenue for each transaction.
  2. Data Transformation: In data preprocessing, a data engineer may need to adjust time duration by subtracting two time values for analysis.
  3. Inventory Management: A product manager wants to assess stock changes by subtracting sold items from the total inventory count.

Example Configuration

Use Case: Calculating Net Profit

In this scenario, an organization wants to determine net profit by subtracting total expenses from total revenue. The values may be obtained from a dataset and passed to the node.

Sample Configuration Data:

json
{
  "inputs": {
    "input1": "15000",  // Total Revenue
    "input2": "5000"    // Total Expenses
  }
}

Expected Output:

The expected output after executing the node with the above input data would be:

json
{
  "output1": 10000  // Net Profit
}

This configuration efficiently calculates the net profit, which is vital for financial reporting and analytics. Each adjustment of input1 or input2 would allow for dynamic updates to net profit calculations as new data becomes available.