rows are not loading into global table from database table

rows are not loading into global table from database table

anil_kumar_n
Not applicable
22 Views
2 Replies
Message 1 of 3

rows are not loading into global table from database table

anil_kumar_n
Not applicable

[ FlexSim 18.1.1 ]

I have a database table which consists of around 1000 rows(appr.). All the rows are shown in oracle database. Whenever I try to connect to table by running query in DBConnector it's not importing the data from table and it's showing an empty global table. How to resolve this issue? This happens with only few tables.

0 Likes
Accepted solutions (1)
23 Views
2 Replies
Replies (2)
Message 2 of 3

JordanLJohnson
Autodesk
Autodesk
Accepted solution

Can you import through the API? It may be that the auto-import code isn't correct in some cases. Once you set up your connection, try this code (modifying variable names, etc.)

Database.Connection con = Database.Connection("DBConnector1");
con.connect();

Database.ResultSet set = con.query("SELECT * FROM mytable");

Table table = Table("GlobalTable1");
int tableSizeCorrect = 0;
int rowCount = 1;
while (set.fetchNext()) {
	if (!tableSizeCorrect) {
		table.setSize(1, set.numFields);
		tableSizeCorrect = 1;
	}

	if (table.numRows < rowCount)
		table.addRow();
	
	for (int i = 1; i <= set.numFields; i++) {
		Variant val = set;
		table[rowCount] = val;
	}

	rowCount++;
}
.


Jordan Johnson
Principal Software Engineer
>

0 Likes
Message 3 of 3

emily_hardySTLSK
Autodesk
Autodesk

@ANIL KUMAR N, did this answer your question?

0 Likes