Customize and export a JSON column
How do you format the JSON values in the database within the exporter file. Im trying to make these values
easily readable by the user exporting them
19 Replies
@Gudao I'm trying to do the exact same thing... did you ever find a solution?
I did find something but I didnt fully go into it
Lemme just try and get it for you
yea, I saw that... doesn't really do what I need tho...
since adding
->listAsJson()
just changes the output from:
Data
one, two, three
to
Data
{'a': 'one', 'b': 'two', 'c': 'three'}
and what I'm looking for is:
A B C
one two threekeep in mind that the number of columns of the file are the number of columns you choose from the model.
That still only creates one column tho π€·ββοΈ
ie: after export it looks like:
Data
data.one, data.two, data,three
Like I said, you wont be able to add columns to the file. Unless you can force a line break, you won't be able to create.
yea, I was just hopind I'd be able to a access the record and do something like this (just some sample pseudocode)
π€·ββοΈ
you can pass the eloquent model to the function
it says in the docs
hmmm where did you see that??
do you mean getting the model inside the
ExportColumn
function? Ideally I'd be able to get it one level higher inside of getColumns
but I haven't found a way to successfully do that yetyea, that just formats that one column... I want to generate multuple dyanmic culums from one JSON column in the DB
I dont think thats possible using the in built export action
got it, yea, that's kinda what it looks like
I know it's an odd use case...
but I'm making a "Form Builder" so the client can use the Filament Builder to generate custom Forms
that's all stored in the
data
column
so when they want to Export the form submissions... Ideally the key/values in data
would get mapped to CSV colums/valuesHi . did you happen to figure out how to do this ?