Issue with Dataview not listing posts

What I’m trying to do

Hi there, I hope someone can help me out here:

We are a design agency working for loads of clients and commission even more suppliers.
What I’m trying to do is set up a system where I can see which Supplier I commissioned for what job.
I have multiple “Project” files that contain all kinds of commissions like print work, web design, signage, etc. This way I have an overview of what stuff I did for a certain client project.
For any given project it can be that I commission printer A to do the business cards, printer B to do the roll-up banner, and so on.
They’re all Suppliers, but in the properties, I state what kind of company they are. For instance, I have multiple Printers, Programmers, Signage, Photographers, etc.

What I want to have is a separate file for each Supplier that shows me what jobs I commissioned to them. The link to these projects should be pulled in from any project file they’re mentioned with their link [[SupplierA]].

This is the code I’m using:

```dataview
TABLE Kosten
WHERE Supplier = [[SupplierA]]

The inline links I pull the data from look like this:

Supplier:: [[SupplierA]]
Order nr: 00000
Invoice nr: 0000
Date: 00-00-000

This is my problem:

This works, but… it only works when you have 1 “Supplier::” mentioned in the project file. I have multiple suppliers mentioned in a client file and Dataview doesn’t show them anymore in the table.

Things I have tried

I had it set up like this in the past:

```dataview
TABLE Kosten
WHERE Programmeur = [[Emonks]]

This gave me the following table, pulling together all the links from 12 project files I worked on with this Supplier:

Scherm­afbeelding 2023-10-25 om 17.34.12

If in the Client file are 2 or more “Programmeur” inline links, Dataview will not show the page link in the table in the “Supplier” file. It will not show the file in each of the Supplier’s files. Instead, it DOESN’T show the project files on either Supplier file.

I hope this makes sense to anybody. It’s very hard to explain, so please ask if you don’t understand it completely.

If your Supplier key can be used to store multiple suppliers (meaning that the value would be a list/an array), I think you can’t use a “direct comparison” (=) in your WHERE :thinking:

But you might try to use Contains() instead :point_right: Contains() and friends :blush:

```dataview
TABLE Kosten
WHERE contains(Supplier, [[SupplierA]])
```

Yes fantastic, that’s the solution. :fist_left:

If I may, I have one more question regarding these Supplier tables:

Is it possible to connect the costs (Kosten) to each Supplier?
In my Project file, there are multiple sub-projects, with their own Supplier and costs. I now simply separate my data paragraphs with a sub-header, but that way all the costs will appear in all the Supplier’s tables.

I have this:

### Sub-project 1
Launch: 2023-05-12
Supplier:: [[Supplier1]]
Kosten:: € 313,30

### Sub-project 2
Launch: 2023-07-06
Supplier:: [[Supplier2]]
Kosten:: € 3.125

This way, all the costs get transported to all Suppliers. What you see here are two costs from different Suppliers, booked on one Project. Both Suppliers have this in their table:

Scherm­afbeelding 2023-10-26 om 09.22.32

If I put anything else on the “Supplier:: [[Supplier1]]” line, it doesn’t work anymore.

Is there a way to split this up so each Supplier ONLY gets his own costs shown in his Supplier file, and NOT the costs from other Suppliers as well?

The context for most inline fields are either the note level or list/task level. In other words, when you have multiple inline fields named the same they’re collated into a list of values for that name. If you repeat this with multiple names, like Supplier and Kosten, you get multiple lists, one for each name, and they’re not connected. (In some cases, if you’re diligent note, items at the same place kind of correlates to the other lists, but it’s not reliable to use that dependency). The previous is related to either context, and is what you’re experiencing now at the note level.

A better approach, currently with no inline objects, is to use the list context when you want to connect together multiple fields. However, it comes with one caveats and advantates.

A rather lengthy example

Try the following in a file of its own:

### Sub-project 1
Supplier:: [[Supplier1]]
Kosten:: € 111

### Sub-project 2
Supplier:: [[Supplier2]]

### Sub-project 3
Supplier:: [[Supplier3]]
Kosten:: € 333

### Other project examples in list/task context

- Sub-project 4
	- [Supplier:: [[Supplier 4]] ]
	- [Kosten:: € 444]
- Sub-project 5, [Supplier:: [[Supplier5]] ], (Kosten:: € 555)
- [S] (Supplier:: [[Supplier6]] ), [Kosten:: € 666]

## Note context

All supplier in both contexts:
`$= dv.span(dv.current().supplier)`

All costs in both contexts:
`$= dv.span(dv.current().kosten)`

## Some list-context related queries

## List queries _at same level_
```dataview
TABLE WITHOUT ID item.text, item.Supplier, item.Kosten
FLATTEN file.lists as item
WHERE file = this.file AND item.Supplier
```

## A task(?) query
```dataview
TASK
FLATTEN
  "==Project: " + meta(section).subpath 
  + "==, Supplier: " + Supplier 
  + ", Cost: " + Kosten as visual 
WHERE file = this.file
  AND status = "S"
```

## Full reference to all information in file

`$= dv.span( dv.current() )`

It’ll detail some variants on where and how to declare inline fields. I’m partial to using tasks for this kind of notation, as it both combines the field into a single task, and it’s easy to decorate and query from other places.

Another note related to declaring currency/numbers, is that when you include the currency symbol it’s no longer a number, but rather a text. This means that if you in a later query would like to sum all your costs, you need to first transform the fields into being numbers again. I tend to rather declare these fields as pure numbers, and if/when I want to present it as a monetary value, I’ll do that in the output of my queries, or through styling of the inline field.

Example with text and presentation

Using the following in a file (where “kostnad” equal “cost”, and my local currency symbol is a prefix of “kr”):

- [S] Hamburger with bacon and cheese, [kostnad:: 129]
- [S] Something else, [kostnad:: 50]

```dataviewjs
const sum = await dv.query(`
TABLE WITHOUT ID sum(rows.item.kostnad)
FLATTEN file.tasks as item
WHERE file = this.file and item.kostnad
GROUP BY true
`)

dv.paragraph("My cost today: " + sum.value.values[0] + " kr")
```

I’ll get the output of :
image


So to sum up my answer: To connect supplier and cost in one-to-one relationship you need to use the list/task context one way or another, and you’re better of using pure numbers instead of numbers and currency in order to do calculation on these values, and then rather do the presentation styling using CSS or within the queries.