DQL
Questions about Dynatrace Query Language
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change All Key Names in Data Sets Using DQL or DPL Queries

36Krazyfists
Advisor

I've already got a K/V DPL that is extracting some data from a field into a JSON object where I will then dynamically parse the data into their own separate fields.


However, before I parse them into their own fields, I'd like to convert the Key names to all lowercase to keep our column naming schema inline with the Dynatrace standard of all lowercase field names.

 

If I always knew what the key names would be, that would be easy, but I don't.  The key names could be anything.

 

Here's an example JSON object I've created with my parsing rule:

{
    "action": "UpdateItem",
    "EP": "1",
    "ID": "-46",
    "AC": "1",
    "ClientId": "SomeIDValue",
    "ClientRequestId": "SomeRequestIdValue",
    "ActID": "SomeActIdValue",
    "CorrelationID": "SomeCorrelationIdValue",
    "RoutingDataMiss": "SomeRoutingDataValue@somewhere.com"
}

 

So, in that above example, I'd want the key names (action, EP, ID, AC, ClientId, ClientRequestId, ActID, CorrelationID, and RoutingDataMiss) to all be converted to lowercase.

 

If DPL had a conversion feature in it (which, man, would that be cool!  If we could just define an option to our extract names that could convert the value to all lower/upper case, that would be so great!), I could have converted them as I extracted them using my dynamic DPL JSON parser.  But, it doesn't...

 

I was thinking some dynamic parser that temporarily converted each k/v pair into an array where I could then pass that to a DQL query that only executed the lower( ) function on every other element of the array, starting with the first, but my brain broke when trying to come up with it.

 

Is there a better way to do this or, is there somebody so good at writing DQL/DPL that something like this would be so easy to them that they'd be willing to help me out with at least an idea of how to go about this?

 

Thanks so much for any ideas!

2 REPLIES 2

IzabelaRokita
Community Team
Community Team

Hey @36Krazyfists ,
I just wanted to check in and see if you still need help with this. If so, I’d be happy to look into it for you! 😊
Please let me know what works best for you.

Julius_Loman
DynaMight Legend
DynaMight Legend

@36Krazyfists, that's not possible using just DQL/DPL, as DQL/DPL does not have an option to do replacements with a placeholder. You can replace only a string with another string or use matchers, but without placeholders.

Dynatrace Ambassador | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts