danielo515 / obsidian-modal-form

Define forms for filling data that you will be able to open from anywhere you can run JS
https://danielorodriguez.com/obsidian-modal-form/
MIT License
204 stars 17 forks source link

[BUG] Multiselect Dataview values not offered to choose from #280

Closed zanodor closed 3 months ago

zanodor commented 3 months ago

Describe the bug

Normal Dataview entry seems to work but that allows only one value to be entered. Multiselect DV doesn't work.

To Reproduce

Make a form with Multiselect Dataview entry querying a property e.g. [...new Set(dv.pages("").flatMap(p => p.somepropertyName || []))].sort((a, b) => a.localeCompare(b))

Behavior

While making the form, Dataview query results are correctly shown. When the form is used in note creation process, no values are offered – not even one.

Expected behavior

All value results created with Dataview are offered to choose from, allowing multi values to be selected as well.

Current workaround

Use Multiselect static solution and add all currently available Dataview results to data.json file manually.

danielo515 commented 3 months ago

I tested that on my vault, and it works. I had to change the propety name to one that exist on my vault (in this case, tags) but everything works as I expect. May you tell me what is in that property name?

Screenshot 2024-06-22 at 10 52 29 Screenshot 2024-06-22 at 10 52 20
zanodor commented 3 months ago

Hey Danny,

Tags were working fine for me before.

Turns out the DV query was not correct. [...new Set(dv.pages("").flatMap(p => Array.isArray(p.workingWith) ? p.workingWith : (typeof p.workingWith === 'string' ? [p.workingWith] : [])).filter(item => typeof item === 'string'))].sort((a, b) => a.localeCompare(b)) seems to have fixed it...

Closing ticket,

Cheers

Z.

danielo515 commented 3 months ago

Happy to see you found the problem!

zanodor commented 3 months ago

Happy to see you found the problem!

ChatGPT4o is quite handy with Obsidian/Dataview related stuff, much better than 3.5.