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

Data from csv including comma

loopy
Observer

Data is currently in a string from a csv for example

2026-05-13 22:51:49.585,email@email.com,service,com.corp.ag,DENIED,,"designer, app-user"

Need to parse it so the data is in format:

| timestamp                      | user_email              | service | domain         | access    | field1 | roles                        | 

| 2026-05-13 22:51:49.585 | email@email.com | service | com.corp.ag  | DENIED |            | designer, app-user | 

The issue being the final field is encapsulated within double quotations and has a comma, and there is a field1 value that is null. Using DPL it doesn't like the blank field, and using splitString(data, ",") splits most of the data correctly but incorrectly the final field which is meant to stay together. 

1 REPLY 1

Mohamed_Hamdy
DynaMight Leader
DynaMight Leader

You can handle both cases using the appropriate DPL matchers: `LD*` for the optional/empty `field1` value, and `CSVDQS` for the quoted CSV string in `roles`, since it contains a comma and should remain as one field.
If the CSV value is enclosed in single quotes instead of double quotes, then `CSVSQS` can be used instead.

Featured Posts