Dashboards & Visualizations

How can I add one column to the end of the table.

pdanilchenko
New Member

For example, I have the following table with 3 columns and 2 rows:
A B C
1 2 3
4 5 6

I want to transform this table and receive the following:
D C
1 3
4 6
2 3
5 6

Tags (1)
0 Karma

niketn
Legend

Following is a run anywhere search for your problem:

| makeresults
| eval A=1,B=2,C=3
| append [| makeresults
| eval A=4,B=5,C=6]
| fields - _time
| eval D = A.",".B
| fields - A B
| makemv delim="," D
| mvexpand D

Query until fields _time is used to generate mock data as per question.
Similar approach with mvzip

| eval D = mvzip(A,B)
| fields - A B
| makemv delim="," D 
| mvexpand D
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@pdanilchenko, were you able to test the suggested query?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

pdanilchenko
New Member

I divided my initial request into two and then apply append to them.

D C
1 3
4 6

append

D C
2 3
5 6

0 Karma

niketn
Legend

Ok sure. That is why context of the problem is required for us as well to assist. You should still try to see whether there is a feasibility of achieving the same result without append for which we would need to see your existing query. If not please convert your comment to answer and accept the same.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@pdanilchenko, it will be helpful if you can give us a glimpse of your final transforming query which generate table with columns A B and C. Because there might be a feasibility of coming down to table with columns D and C directly.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...