Context key reorganize

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

Context key reorganize

L2 Linker

Hi!

 

I want to be able to manipulate context keys by selecting the keys I want, and moving them to upper level. E.g.: Assuming I have the following in the context:

 

f1.JPG

I want to have a new context key with only Name and HairColor:

 

f2.JPG

 

GetFields transformer seems to have similar functionality, however I cannot tell it to get subkeys, e.g. Appearance.Head.HairColor.

 

Any ideas?

Thanks,

Antanas

Curious Fellow
1 accepted solution

Accepted Solutions

L3 Networker

A jmespath transformer can do this.

 

You can test your jmespath expression in the war room like this:

chrking_0-1681441414955.png

Then use it as a transformer:

chrking_1-1681441569597.png

And finally check the results in the context:

chrking_2-1681441632945.png

 

Also... John should maybe get his red eyes looked at, I'm not a doctor but that doesn't seem normal 🤣

 

 

 

View solution in original post

4 REPLIES 4

L3 Networker

I believe you need to add more context to what you intend by "selecting the keys I want and moving them to the upper level". Why not just created a new context Upper-Level key? You can try running !Print  with this value => ${ParentKey.[].appearance.head}, it should grab all the values you want. Then use !Set or !Setmultiplevalues depending on what works for you. 

Let me know what works for you. 

L3 Networker

A jmespath transformer can do this.

 

You can test your jmespath expression in the war room like this:

chrking_0-1681441414955.png

Then use it as a transformer:

chrking_1-1681441569597.png

And finally check the results in the context:

chrking_2-1681441632945.png

 

Also... John should maybe get his red eyes looked at, I'm not a doctor but that doesn't seem normal 🤣

 

 

 

Hi @chrking  , this worked like a charm! Thanks a lot.

This was just a mock data, not to worry about someones red eyes, all are safe and healthy 🙂

 

Curious Fellow

Hi @michaelsysec242 ,

I think the problem with your suggested approach is that i can't output multiple keys in a singe query, therefore i wouldn't be able to properly set them into one key.

Anyways, the other suggestion was to use jmespath as a transformer, and that worked quite well.

 

Thanks!

Curious Fellow
  • 1 accepted solution
  • 1188 Views
  • 4 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!