Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs on filtering with entity alternatives #3004

Open
nnhjy opened this issue Nov 7, 2024 · 4 comments · Fixed by spine-tools/Spine-Database-API#467
Open

Bugs on filtering with entity alternatives #3004

nnhjy opened this issue Nov 7, 2024 · 4 comments · Fixed by spine-tools/Spine-Database-API#467
Labels
bug Something isn't working
Milestone

Comments

@nnhjy
Copy link
Member

nnhjy commented Nov 7, 2024

Please replicate the issue with this DB testin.zip, where the unitB with entity alternative being false in "Base" alternative will still be passed to another DB by a Merger.

@nnhjy nnhjy added the bug Something isn't working label Nov 7, 2024
@jkiviluo
Copy link
Member

jkiviluo commented Nov 8, 2024

Right. It seems like alternative filter is not working as expected. Not just for the merger tool, but also for other tools and exporter. It filters parameter data, but not entities. Scenario filter does work though.

It's not just that setting entity alternative to 'false' does not filter out those entities, but all entities are always passed forward. They should not be unless they are part of the selected alternatives (either through setting true or through 'active by default' - although in case of ND entities all the parent entities should be active of course).

@jkiviluo jkiviluo changed the title alternative filter to exclude entities not working Alternative filter does not filter entity alternatives (just parameters) Nov 8, 2024
@jkiviluo jkiviluo added this to the next release milestone Nov 8, 2024
@soininen
Copy link
Contributor

soininen commented Nov 8, 2024

Entity alternatives have not been implemented for the alternative filter yet.

soininen added a commit to spine-tools/Spine-Database-API that referenced this issue Nov 14, 2024
Alternative filter now filters entities and parameter values
based on entity alternatives, much like scenario filter does.
Also, we now filter alternatives and scenarios, too.

Re spine-tools/Spine-Toolbox#3004
@soininen
Copy link
Contributor

Alternative filter is now feature-complete.

@nnhjy
Copy link
Member Author

nnhjy commented Dec 13, 2024

Not sure whether it is better to open a new issue.
When there is an entity_group associated with an alternative excluded in a filter, the filtering process gets unhappy (same for the scenario and alternative filters):

...
  File "C:\Tools\Spine\Toolbox\Spine-Database-API\spinedb_api\db_mapping_base.py", line 1130, in become_referrer
    add_self_as_referrer(field_value)
  File "C:\Tools\Spine\Toolbox\Spine-Database-API\spinedb_api\db_mapping_base.py", line 1118, in add_self_as_referrer
    raise RuntimeError(f"Reference id {ref_id} in '{ref_table}' table not found")
RuntimeError: Reference id 1 in 'entity' table not found

This DB testin.zip should allow replicating the issue.

@nnhjy nnhjy reopened this Dec 13, 2024
@nnhjy nnhjy changed the title Alternative filter does not filter entity alternatives (just parameters) Improve filtering by entity alternatives Dec 13, 2024
@nnhjy nnhjy changed the title Improve filtering by entity alternatives Bugs on filtering with entity alternatives Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants