title: NodeJS SqlTableValuedInsert function not working independently
body: <p>I have a function in Nodejs where values will be inserted and updated in SQL Table. The below is the function.</p>
  <pre><code>createUpdateSigns(data, pointId, res){
          const sqc = this.sqc
          let panelinfoTable = new sql.Table();
          this.createpanelinfoTable(panelinfoTable, data);  
          let panelDataTable = new sql.Table()
          this.createpanelDataTable(panelDataTable,data)  
          let panelConditionTable = new sql.Table()
          this.createpanelConditionTable(panelConditionTable,data) 
          let query = `
              EXEC dbo.CreateUpdateSignPointDetails
              @pointId, @roadName, @roadStart, @roadEnd, @station, @side, @offSet,
              @supportType, @breakaway, @numberofSupports, @supportLength, @postSize,
              @createdDate
          `
          //let response = `callback to ID point ${pointId} layer ${minorId}`
          let params = []
          sqc.SqlExecuteStatementCallback(
              query, params, null, (result) =&gt; {
                  console.log('Result here ',result)
                  const { isUpdate,pointId } = result[0];            
                  let response = `callback to ID SingLayer ${pointId} isUpdate 
                                 ${isUpdate}`;     
                  res.send(response)
                  if(panelinfoTable.rows.length&gt;0){
                      sqc.SqlTableValuedInsert((err,request) =&gt; {
                          console.log('panelInfo Table logged ',panelinfoTable) 
                          request.input('signlayerId', sql.Int, pointId); 
                          request.input('panelinfoTable', panelinfoTable); 
                          console.log(err)
                      }, 'SL_CreateUpdatePanelInfo');
                  }
                  if(panelDataTable.rows.length&gt;0){
                      sqc.SqlTableValuedInsert((err,request) =&gt; { 
                          request.input('signlayerId', sql.Int, pointId); 
                          request.input('panelDataTable', panelDataTable); 
                          request.input('panelConditionTable',panelConditionTable)
                          console.log(err)
                      }, 'SL_UpdatePanel_Condition_Data');
                  }
          });
      }
  </code></pre>
  <p>I have two types of saving in the application. When a new Geographic point is created in google maps and related values to that point are passed to the above function all the rows in different sql tables are created perfectly fine. However, when I am trying to save a new row in a SQL Table for an existing Geographic point which is already present in the database <code>SqlTableValuedInsert</code> is not working at all. It is not inserting a new row which should be associated with the existing database point.
  The <code>SqlTableValuedInsert</code> throws the following error:</p>
  <pre><code>error:  TypeError: Cannot read properties of undefined (reading 'input')
  </code></pre>
  <p>If anyone can direct me what can cause this problem because I don't understand why saving a new point will make it work and not for an existing point.</p>