8000 [bug] Datacore only retrieves the first value of repeated inline fields · Issue #107 · blacksmithgu/datacore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[bug] Datacore only retrieves the first value of repeated inline fields #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue an 8000 d 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

Open
tripkmin opened this issue May 4, 2025 · 3 comments
Open

Comments

@tripkmin
Copy link
tripkmin commented May 4, 2025

Hello,
First of all, thank you for developing Datacore. I’ve been a heavy user of DataviewJS, and I was excited to discover the Datacore plugin—it’s a fantastic step forward. While testing various use cases, I found an issue related to how Datacore handles inline fields when multiple values are defined under the same key.

Consider the following example markdown:

asdfasdfasdf (name:: tracer), asdfasdf (name:: ash)

Using DataviewJS, this returns both values as expected:

const { file, ...rest } = dv.current()
console.log(rest)

// Output:
// { name: ["tracer", "ash"] }

However, when using Datacore, only the first occurrence is returned:

const { $infields } = dc.currentFile()
console.log($infields)

/*
{
    "name": {
        "key": "name",
        "raw": "tracer",
        "value": "tracer",
        "position": {
            "line": 0,
            "start": 13,
            "startValue": 20,
            "end": 28
        },
        "wrapping": "("
    }
}
*/

It seems that Datacore is not capturing all values when the same inline field key appears multiple times in a file.

I hope this can be addressed soon—Datacore has great potential, and resolving this would make it even more powerful. Thank you for your hard work!

@tripkmin tripkmin changed the title Datacore only retrieves the first value of repeated inline fields [bug] Datacore only retrieves the first value of repeated inline fields May 4, 2025
@blacksmithgu
Copy link
Owner

This is currently an intentional change to align datacore closer to how the Properties / frontmatter view for files works. For multiplicity, the recommendation is to use tags instead.

Can you explain your use case for multiple inline fields with duplicate key names?

@iamrecursion
Copy link

I use this feature too, as it allows a fluent way to simply accumulate multiple valid values for a field. I use it for character work, for example, where referring to a character's name, nicknames, and so on, can all get accumulated under the "name" field.

@tripkmin
Copy link
Author
tripkmin commented May 8, 2025

This is currently an intentional change to align datacore closer to how the Properties / frontmatter view for files works. For multiplicity, the recommendation is to use tags instead.

Can you explain your use case for multiple inline fields with duplicate key names?

Hi again—and thanks for the follow‑up!

I use the Periodic Notes plugin to generate a fresh daily note every morning. Throughout the day I jot down my diary entries in a completely free‑form way. Whenever something feels important—an experiment to try, a key issue, a quick metric—I capture it with an inline field (key:: value). Those inline fields are then surfaced in my weekly and monthly notes to create rolled‑up dashboards.


Concrete English example

(try:: cold shower) — surprisingly effective for waking up.

(try:: fixed morning route → study‑café)
Maybe buy a monthly pass so I *have* to go?

Breathing exercises to reset posture.  
Walk 5 000 steps before lunch.

What DataviewJS returns

const { "try": experiments } = dv.current();
dv.list(experiments);

// → ["cold shower", "fixed morning route → study‑café"]

That array lets me:

  • list all unfinished experiments on a dashboard,
  • track how many new “try” items I added this week,
  • feed them into a Kanban board, etc.

What Datacore returns now

const { $infields } = dc.currentFile();
console.log($infields["try"].value);
// → "cold shower"   // the second value disappears

Half the structured data is gone, so my existing dashboards break.


Why tags can’t replace duplicate inline fields

Need Inline field (duplicate keys) Tag (#)
Fits mid‑sentence without breaking prose
Supports multi‑word / arrow notation
Preserves order & allows deliberate duplicates
Handles numeric / emoji values (rating:: 4.5)

Tags are perfect for broad categories (#project/alpha), but they can’t express the fine‑grained, in‑context metadata that duplicate inline fields provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0