lib/z_Original_Working_meta.js
// Declare a function that we will use to drill into the object.
Declare a function that we will use to drill into the object.
Declare a function that we will use to drill into the object .
function drillIntoObject(address, objKey, previousPath, objectNestLevel)
            {      
              for (let property in address[objKey][objKey + "0"])
              {
                if(address[objKey][objKey + "0"][property][property + "0"])
                {
                  drillIntoObject(address[objKey][objKey + "0"], property, previousPath + objKey +  "_" + objKey + "0_", objectNestLevel + 1);
                }
                else 
                { 
                  let objectPath = objKey + "_" + objKey + "0_" + property;
                  objectPath = previousPath.length === 0 ? objectPath : previousPath + objectPath; 
                  let defaultElementsObject = address[objKey][objKey + "0"][property].defaultElements;
                  for (let elementKey in defaultElementsObject) 
                  {
                  combinedDefaultElementsObject[objectPath] = defaultElementsObject[elementKey];
                  }
                } 
              } 
            }
function drillIntoObject ( address , objKey , previousPath , objectNestLevel ) { for ( let property in address [ objKey ] [ objKey + "0" ] ) { if ( address [ objKey ] [ objKey + "0" ] [ property ] [ property + "0" ] ) { drillIntoObject ( address [ objKey ] [ objKey + "0" ] , property , previousPath + objKey + "_" + objKey + "0_" , objectNestLevel + 1 ) ; } else { let objectPath = objKey + "_" + objKey + "0_" + property ; objectPath = previousPath . length === 0 ? objectPath : previousPath + objectPath ; let defaultElementsObject = address [ objKey ] [ objKey + "0" ] [ property ] . defaultElements ; for ( let elementKey in defaultElementsObject ) { combinedDefaultElementsObject [ objectPath ] = defaultElementsObject [ elementKey ] ; } } } }
Declare a function that we will use to drill into the object.
Declare a function that we will use to drill into the object .
// Check each property of the subobject to see if it too is an object. // If the property is also an object then drill deeper. // This function calls itself so as to go deeper into the object. // This property is not an object. We are at the end of the branch where we encounter a data field. // Assemble the path through the current object to the current data field. // If the current data field is nested then prepend the path to include the parent objects. // Grab all the defaultElements (form controls) for this data field. // There may be several - Think time and distance controls required to calculate a velocity field // Loop through defaultElementsObject. // Grab each defaultElement and copy to an object which will hold all defaultElements for the table. // End of: else - This property is not an object. // Check each property of the subobject to see if it too is an object.