2026-09-27 - SearchResult equation requiredData

From Izara Wiki
Jump to navigation Jump to search

Service - Search Results

Overview

  • allow for equations to be performed to return a requiredData field
  • example: calculating a converted amount using Izara Currency project

Idea

  • use similar equation notation as combinationEquation in Service - Transform Units
  • variableTags inside the equation can point to a linkPath or findData result
  • all variableTags find their values before the equation is performed

Process

  • when an equation requiredData is detected
  • parse the equation to find all linkPaths/findData
  • (perhaps limit number of tags so can handle in one invocation)
  • setup awaitingMultipleSteps for all variableTags
  • send out linkPaths/findData requests
  • as each returns need somewhere to store the values, if limited perhaps save in requiredData record, otherwise maybe intermediateData or a new table
  • once awaitingMultipleSteps complete perform equation and complete the requiredData

Equation Syntax

{
  requiredDataObjects: {
     hash_requiredDataObjectA: { // normal findData
       fieldName: "fieldname of main objType",
     },
     hash_requiredDataObjectB: { // LinkPath
       fieldName: "fieldname of last fieldName for linkPath",
       linkPathObjectId: "hash_linkPathObjectA",
     }
     hash_requiredDataObjectC: { // equation
       equation: "[linkPath:hash_linkPathObjectB]*([linkPath:hash_linkPathObjectC]-[findData:fieldname])", // two linkPaths and a findData
     }
  },
  linkPathObjects: {
    hash_linkPathObjectA: {
		// ...
    },
    hash_linkPathObjectB: {
		// ...
    }
    hash_linkPathObjectC: {
		// ...
    }
  },
  linkPathSteps: {
	// ...
  }
}