Home > front end >  In an AnyLogic DB Table, Can I Directly Put a Variable's Value Into a Table
In an AnyLogic DB Table, Can I Directly Put a Variable's Value Into a Table

Time:07-19

Here is the db table.

Here are the project and pallette tables to show the format of the files and variables

Here is the list of variables

Now,for variable int timeTaken, it updates every time step. I want each time step's timeTakenin its own DB. Now, in the db table, I place in default value: wholesaler.timeTaken into the default value. How do I place each timeTaken into a database?

Error I got when I put wholesaler.TimeTaken

CodePudding user response:

You have to add it by writing a database query. You can use both SQL and QueryDSL syntax. More info: https://anylogic.help/anylogic/connectivity/querying.html

For example, if using queryDSL syntax, you should make it look like this:

 insertInto(db_table)
        .columns(db_column)
        .values(wholesaler.timeTaken)
        .execute();

Put it in a function and you can simply call it. Please make sure datatypes of your variable and assigned column are the same. Error probably occured because of different datatypes. You can leave the default value blank.

The easiest way building a query is by using the wizard: icon query wizard

Good luck!

  • Related