I want to split the list contained in a Dataview column

What I’m trying to do

Hi,There :slight_smile:

Before I go any further, I’d like to say that I did a machine translation, so there may be some strange English :cry:

I would like to ask a question about Dataview’s DQL.
With my query, I have multiple listings in one column.
I want to make them one column at a time, like in the picture below

Things I have tried

I have time-stamped certain notes in a list format.
It looks like this:

## Record.
- 2024-02-12 19:14:55
- 2024-02-12 13:27:14
- 2024-02-12 08:46:00
- 2024-02-11 23:50:00
- 2024-02-11 15:30:00
- 2024-02-11 09:00:00

This was expressed using the following DataView DQL

table without id 
file.lists.text as "TimeStamp"
from "path/to/file"

With this formula, it will look like the left side of the previous picture, i.e., one column contains six listings

Next, I tried to see if I could split the listings using the Flatten keyword.
The query is as follows:

table without id 
file.lists.text as "TimeStamp"
from "path/to/file"
flatten file.lists.text

Then the list was not split, but multiplied to six, as follows:

I didn’t know how to act any further. :cold_sweat:

I’d be happy to help.

When using FLATTEN ..., please use FLATTEN ... as something. Then you save yourself from some issues like you just experienced since you didn’t specify what you wanted it flattened into, and then used the same name (which then happened to refer to the original list again) causing it to duplicate its values.

So try this one:

table without id 
item.text as "TimeStamp"
from "path/to/file"
flatten file.lists as item

Thank you very much!
You have helped me to get this resolved successfully.

I see, so the TABLE value was not linked to the FLATTEN value!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.