mdelobelle / metadatamenu

For data management enthusiasts : type and manage the metadata of your notes.
https://mdelobelle.github.io/metadatamenu
MIT License
477 stars 27 forks source link

Table view doesn't display class fields values #647

Open neocorsten opened 3 months ago

neocorsten commented 3 months ago

Discussed in https://github.com/mdelobelle/metadatamenu/discussions/631

Originally posted by **neocorsten** March 11, 2024 Hello, I am new to metadata menu and I must be doing something wrong. I have a class "contact" with different fields (first name, last name, business role, etc...). I have created different notes for each contact and assigned each with the "contact" class. Each contact has the class icon next to it and when I click it, it shows the right values against each class fields. If I create a simple data view with the following code it displays all fields correctly: ```dataview table without id file.link as Name, Company as "Company", BusinessRole as "Role", LastContact as "Last Contact" from #contact and -"00_Templates" ``` If I use data view js it only shows all the contacts listed but the fields are not being pulled. They are all blank ```dataviewjs const {fieldModifier: f} = this.app.plugins.plugins["metadata-menu"].api; dv.table(['Contact', 'Company', 'Business Role', 'Email', 'Last Contact'], dv.pages('') .where(p => p.fileClass == 'contact') .filter(p => !p.file.path.includes('00_Templates')) .filter(p => !p.file.path.includes('00_Classes')) .map(p => [ p.file.link, f(dv, p, "Company"), f(dv, p, "BusinessRole"), f(dv, p, "Email"), f(dv, p, "LastContact") ]) ); ``` Finally, if I click the contact class to go to Table view I only see all the notes from that class but all the fileclass fields show blank, same as with the data view js query above, and I don't know why. Basically, besides the first column fetching the notes belonging to the "contact" class, all other columns only show the field names as headers but no value within the table. Can someone kindly put me on the right track to fix this? Thanks.
LynetteCullens commented 2 months ago

It's May......

LynetteCullens commented 2 months ago
const {fieldModifier: f} = this.app.plugins.plugins["metadata-menu"].api; 
dv.table (["File", "mathLink", "AltNotation", "Dimensions", "StaticDimensions", "MKS", "CGS", "FPS", "LinkedFormula"], 
    await Promise.all(dv.pages('').map(async p => [ 
        p.file.link,
        await f(dv, p, "mathLink"),
        await f(dv, p, "mathLink-blocks.AltNotation"), 
        await f(dv, p, "mathLink-blocks.Dimensions"), 
        await f(dv, p, "mathLink-blocks.StaticDimensions"),
        await f(dv, p, "mathLink-blocks.MKS"),
        await f(dv, p, "mathLink-blocks.CGS"),
        await f(dv, p, "mathLink-blocks.FPS"),
        await f(dv, p, "mathLink-blocks.LinkedFormula"), 
        ]) 
)) 

Random person from 2022 formatted their dtaviewjs like this. It removed my blanks with their actual value.

neocorsten commented 2 months ago

Thanks for your response and help. Whether I use filters or not, it doesn't seem to work using the same sort of structure you. It might be how I treat fileclass. Not sure really.

LynetteCullens commented 2 months ago

const {fieldModifier: f} = this.app.plugins.plugins["metadata-menu"].api;

This Didn't Work?


const {fieldModifier: f} = 
this.app.plugins.plugins["metadata-menu"].api;

dv.table(['Contact', 'Company', 'Business Role', 'Email', 'Last Contact'], await Promise.all(dv.pages('') .where(p => p.fileClass == 'contact') .filter(p => !p.file.path.includes('00_Templates')) .filter(p => !p.file.path.includes('00_Classes')) .map(async p => [ p.file.link, await f(dv, p, "Company"), await f(dv, p, "BusinessRole"), await f(dv, p, "Email"), await f(dv, p, "LastContact"), ]) ))

neocorsten commented 2 months ago

No it doesn't. Which might mean the issue is elsewhere. When I click on my contact class, Table view doesn't populate correctly either. The contact column shows the entries but the other fields are blank. For example, Fileclass fields have FirstName and LastName defined as Input fields. They are populated for each contact (Contact John Doe has Properties => fileClass=contact, FirstName = John, LastName= Doe). But they don't pull out in Table view. Thanks for your help, really appreciate it. What I am doing is basic, or should be anyway.

LynetteCullens commented 2 months ago

No it doesn't. Which might mean the issue is elsewhere. When I click on my contact class, Table view doesn't populate correctly either. The contact column shows the entries but the other fields are blank. For example, Fileclass fields have FirstName and LastName defined as Input fields. They are populated for each contact (Contact John Doe has Properties => fileClass=contact, FirstName = John, LastName= Doe). But they don't pull out in Table view. Thanks for your help, really appreciate it. What I am doing is basic, or should be anyway.

My workaround for the longest has been to use DBFolder and Projects when my metadata was much more simple. Their tables are much more aesthetically pleasing also. Feel free to link a test vault if the problem continues. I'm sure it can be fixed.

neocorsten commented 2 months ago

Thanks. I have just created a test vault and it works in there (which is great news). I'll have a look tomorrow to see what's different between the two. Also thanks for the recommendation regarding DBFolder and Projects. Will have a look. @LynetteCullens thanks again for your help.