question

ANIL KUMAR N avatar image
0 Likes"
ANIL KUMAR N asked Emily Hardy commented

rows are not loading into global table from database table

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.

FlexSim 18.1.1
flexsim users manualflexscript error
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered Emily Hardy commented

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[i];
		table[rowCount][i] = val;
	}

	rowCount++;
}
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Emily Hardy avatar image Emily Hardy ♦ commented ·

@ANIL KUMAR N, did this answer your question?

0 Likes 0 ·