Rename table headers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rename table headers

L0 Member

Hi all 😀

 

I have a table of data in Cortex XSOAR (e.g., a list of dictionaries with results from a query), and I need to rename one of the column headers before processing it further in my playbook.

 

For example, I want to rename the column oldName to newName. How can I achieve this either within a script, automation, or as part of a playbook task?

 

If there are any best practices or recommended approaches for handling this kind of column renaming, I'd appreciate the guidance!

 

Thanks!

1 accepted solution

Accepted Solutions

L5 Sessionator

Hi @nivnetanel96, this is the simplest way I can think of without modifying the context.

 

Example using the File key. Table below showing the original value of the key as a table.

Screenshot 2024-10-17 at 2.02.04 PM.png

 

Same ToTable function with a bunch of transformers applied.

Screenshot 2024-10-17 at 2.04.16 PM.png

The output should looks like below.

Screenshot 2024-10-17 at 2.05.16 PM.png

 

There are other methods but they require some programming knowledge and modification of the CommonServerUserPython script. You can check the pascalToSpace function inside CommonServerPython as an example.

 

Thanks,

 

Jeremy.

View solution in original post

2 REPLIES 2

L1 Bithead

@nivnetanel96 Are these table headers the keys of list of dictionaries you are getting back in response to your query? So when you say you want to change the header value do mean that you want to change one of the dict keys so that when you display them in a table the header is changed?

L5 Sessionator

Hi @nivnetanel96, this is the simplest way I can think of without modifying the context.

 

Example using the File key. Table below showing the original value of the key as a table.

Screenshot 2024-10-17 at 2.02.04 PM.png

 

Same ToTable function with a bunch of transformers applied.

Screenshot 2024-10-17 at 2.04.16 PM.png

The output should looks like below.

Screenshot 2024-10-17 at 2.05.16 PM.png

 

There are other methods but they require some programming knowledge and modification of the CommonServerUserPython script. You can check the pascalToSpace function inside CommonServerPython as an example.

 

Thanks,

 

Jeremy.

  • 1 accepted solution
  • 564 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!