Behnaz
Behnaz

Reputation: 25

Not unique database value! error in AnyLogic

I have a database with two rows and three columns as follows:

|time |product|quantity | 16-04-2024 11:41:14| A |3 | 16-04-2024 12:41:14| B |7

What I am trying to do is to use this db for arrival schedule of "source" block in AnyLogic. The issue is with the quantity column.. when I activate "Multiple agents per arrival" option, I get this error:"Not unique database value!". I appreciate it if someone can help me with that. enter image description here

If I do not activate "Multiple agents per arrival" option, the model works without any error. It just creates one agent per row.

Upvotes: 1

Views: 76

Answers (2)

Behnaz
Behnaz

Reputation: 25

I used this query for "Agent per arrival" and it worked.

self.databaseTable.getValue( "quantity", int.class )

Upvotes: 0

Benjamin
Benjamin

Reputation: 12795

You need to add a choice condition, AnyLogic does not know which row's quantity you want to use.

(Think about it: AL wants to know "how many agents per arrival should I create?" and you tell it "whatever is in the quantity column". But there are several values in that column, so which one is it? :) )

Upvotes: 0

Related Questions