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

Weird math #2508

Open
bpavuk opened this issue Jan 15, 2025 · 2 comments
Open

Weird math #2508

bpavuk opened this issue Jan 15, 2025 · 2 comments
Labels
bug Something isn't working. mobile Issues related to Dataview on mobile Obsidian.

Comments

@bpavuk
Copy link

bpavuk commented Jan 15, 2025

What happened?

If you try to render this:

### Mission 1: Long Day in Dunwall
- Target: (m1target:: `= 894`) coins
- Collected: (m1collected:: `= 791`) coins
- Subt. debt: [m1debt:: `= number(this.m1target)-number(this.m1collected)`] coins
- `= number(this.m1debt)`

...the last line will say 1 instead of 103, and this flips up a lot of calculations.

DQL

No response

JS

No response

Dataview Version

0.5.67

Obsidian Version

1.7.7

Device

Samsung Galaxy Note 8

OS

Android 9

@bpavuk bpavuk added bug Something isn't working. mobile Issues related to Dataview on mobile Obsidian. labels Jan 15, 2025
@holroy
Copy link
Contributor

holroy commented Jan 23, 2025

As I just explained in #2509 when you do inline queries in connection with inline fields, it's the query which is stored not the resulting value of that query. When you in addition re-use values from other non-evaluated queries you are asking for problems.

You are not guaranteed any order of execution, and as such you can't rely on a field with a query being evaluated before or after another query. It's pure luck/coincidence.

A safer way to do something similar would be to assign values to a list of cost, and then present it as `=sum(this.cost)` somewhere in your note.

@bpavuk
Copy link
Author

bpavuk commented Jan 23, 2025

Which means I need to find another solution for in-game bookkeeping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. mobile Issues related to Dataview on mobile Obsidian.
Projects
None yet
Development

No branches or pull requests

2 participants