Question: [![enter image description here](https://i.stack.imgur.com/3CDDt.png)](https://i.stack.imgur.com/3CDDt.png)

I have a table like this in which i have some values for location . If this location values contains any other values except `"California" "New york" ,"HQ" , "Florida"` it should show alert message like location is not valid .
I have tried following code .

```
   tabledata.DataTable.forEach(function (data) {
       var locate = data.Location;
     if (locate.includes(data.BranchName)) {
       alert("Success");
      } else {
     alert("failure");
             }                            
      })

```

**UPDATE**

```
branchDetails.forEach(function (data) {
       console.log(data.BranchName);
  });

```

here `data.BranchName` contains `"California" "New york" ,"HQ" , "Florida"` and `locate` contains the table location value . 

My issue here is even though the table contains `"HQ"` it is showing as failure

Answer: 
You cannot pass parameters to SQL Server views. <https://www.mssqltips.com/sqlservertip/5147/limitations-when-working-with-sql-server-views/>
```
SELECT        dbo.General_Ledger_Detail.Accounting_ID, dbo.General_Ledger_Detail.Cost_Centre, dbo.General_Ledger_Detail.Product_ID, 
                         dbo.General_Ledger_Detail.Accounted_Amount AS Amount, dbo.General_Ledger_Detail.Account_Name, dbo.General_Ledger_Detail.Accounting_Date, 
                         dbo.Account_Codes_Sales_OPEX$.[Opex Type], dbo.LogSolOpexCC.Logistic_Solutions_Type
FROM            dbo.General_Ledger_Detail INNER JOIN
                         dbo.Account_Codes_Sales_OPEX$ ON dbo.General_Ledger_Detail.Accounting_ID = dbo.Account_Codes_Sales_OPEX$.[Account Code] INNER JOIN
                         dbo.LogSolOpexCC ON dbo.General_Ledger_Detail.Cost_Centre = dbo.LogSolOpexCC.Cost_Centre
GROUP BY dbo.General_Ledger_Detail.Accounting_ID, dbo.General_Ledger_Detail.Cost_Centre, dbo.General_Ledger_Detail.Product_ID, 
                         dbo.General_Ledger_Detail.Accounted_Amount, dbo.General_Ledger_Detail.Account_Name, dbo.General_Ledger_Detail.Accounting_Date, 
                         dbo.Account_Codes_Sales_OPEX$.[Opex Type], dbo.LogSolOpexCC.Logistic_Solutions_Type
HAVING        (dbo.General_Ledger_Detail.Accounting_Date BETWEEN DATEADD(mm, DATEDIFF(mm, 0, GETDATE()) - 1, 0) AND DATEADD(mm, 1, GETDATE()))

```