通过数据库循环erylogic

发布于 2025-02-01 17:24:05 字数 541 浏览 0 评论 0原文

在我的模型中,我想循环浏览包含多个列的数据库(见示例)。其背后的想法是我想根据数据库中的行创建动态事件。

,但是我不知道如何通过任何logic中的数据库迭代,也无法找到使用数据库的循环的示例。

我的问题的假码看起来像这样:

For order in orderdatabase:
   Create order based on (order.name, order.quantity, order.arrivaltime, order.deliverylocation)

循环中的顺序是数据库的每个行,以及创建的值基于该特定行的不同列值。

有人可以给我一个简单的例子,说明如何为这个特定问题创建这样的循环。

提前致谢。

In my model I want to loop through the database which contains multiple columns (see example) by an event. The idea behind it is that I want to create dynamic events based on the rows in the database.

enter image description here

But I've no clue how to iterate through a database in anylogic and also was not able to find an example of a loop with a database.

The dummycode of my problem would look something like this:

For order in orderdatabase:
   Create order based on (order.name, order.quantity, order.arrivaltime, order.deliverylocation)

Where order in the loop is every row of the database, and the value on which the creation is based based on the different column values of that specific row.

Can somebody give me a simple example of how to create such a loop for this specific problem.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

演多会厌 2025-02-08 17:24:05

使用数据库查询向导:

  1. 将光标放入代码字段中,
  2. 这将使您可以打开数据库向导
  3. 选择您需要的东西(在您的情况下,您想要“返回的行并做某事”选项
  4. 单击“确定”
  5. 调整虚拟代码以使其可以完成您想要的

详细信息和示例,请检查示例模型和任何logogic帮助,并详细说明所有选项。

Use the database query wizard:

  1. put your cursor into a code field
  2. this will allow you to open the database wizard
    enter image description here
  3. select what you need (in your case, you want the "iterate over returned rows and do something" option
    enter image description here
  4. Click ok
  5. adjust the dummy code to make it do what you want

For details and examples, check the example models and the AnyLogic help, explaining all options in detail.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文