Skip to content

Records in table are always insert empty in the table #1484

@amiagarw

Description

@amiagarw

Hi We are planing to upgrade the alssql version from .2 to 1.7.3. We are using the browser version of alasql and download from https://cdn.jsdelivr.net/npm/[email protected]( Got this link from official site (https://github.com/AlaSQL/alasql) and include in the our webpage. But with latest records in table are always insert empty in the table.

We are trying to create the table 'BCPartners' and then insert the data into JSON formate. We can see the records set but each column has blank value.This is a blocker for us so need help ASAP
Below are the sample code and more details
-----------
Sample HTML page
---------------------

<html>

<head></head>

<body>
    <script language="javascript" src="scripts/3rdParty/alasql.min.js"></script>
    <script language="javascript" src="test.js"></script>
    "CREATE TABLE IF NOT EXISTS [BCPartners] ( RecordNum INTEGER PRIMARY KEY AUTOINCREMENT , [TABLE_NAME] TEXT DEFAULT \"\", [BC] TEXT DEFAULT \"\")" =
    <script>
        var data = [
    
          	 {TABLE_NAME: "S_CON_ADDR", BC: "Pharma Address Inter Table - CE,CUT Address for Ac…,Pharma Pick Address,CUT Address Inter Table - CE"},
          	 {TABLE_NAME: "S_PROD_INT", BC: "Pharma Internal Product,Internal Product,FINS Security,Pharma Sample Lot for Picklist"},
          	{TABLE_NAME: "S_LST_OF_VAL", BC: "List Of Values,PickList Generic,List Of Values Chi… Of Values Dynamic,PickList Hierarchical Sub-Area"},
                   {TABLE_NAME: "S_EMP_PRDINT", BC: "Pharma Personal Products List,Pharma Personal Samp…Items List,Pharma Personal Promotional Items List"},
          	 {TABLE_NAME: "S_ADDR_PER", BC: "CUT Address,CUT Address - CE,Pharma Address"},
          	 {TABLE_NAME: "S_LIT", BC: "Admin Sales Tool,Admin Sales Tool Thumbnail"},
          	{TABLE_NAME: "S_EVT_ACT", BC: "Pharma Professional Call - Mobile,Pharma Account Call,Pharma Professional Call,Action"},
          	 {TABLE_NAME: "S_MSG_PLAN", BC: "LS Messaging Plans BC,LS Admin Messaging Plans BC"},
          	 {TABLE_NAME: "S_ACT_PRDINT", BC: "LS Pharma Call Sample Dropped Rollup,LS Pharma Pro…motional Items Dropped,Pharma Call Sample Dropped"},
    
          ]
    
    
          function showResult(x){
              document.getElementById('result').textContent = JSON.stringify(x,  null, '\t');
          }
    
    
          CreateDB();
    </script>

    <xmp id="result"></xmp>
</body>

</html>

---------- Sample JS (test.js) code ---------

function CreateDB() {
	debugger
	var inmemDB = new alasql.Database("alasql_db");
	window._memDB = inmemDB;
	var
		query = "CREATE TABLE IF NOT EXISTS [BCPartners] ( RecordNum INTEGER PRIMARY KEY
	AUTOINCREMENT, [TABLE_NAME] TEXT DEFAULT\ "\", [BC] TEXT DEFAULT \"\")"
	inmemDB.exec(query);;
	inmemDB.exec("insert into [BCPartners] select * from ?
			",[data]);
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions