We've moved!
For WDL questions, see the WDL specification and WDL docs.
For Cromwell questions, see the Cromwell docs and please post any issues on Github.

getting keys and values from a map?

yfarjounyfarjoun Broad InstituteDev ✭✭✭

Hi I have a wdl Map[String, String] and I'd like to get the list of key and the list of values as two Arrays:

Array[String] keys=keys(map) or map.keys
Array[String] values=values(map) map.values

I don't think I can do this.

While I could write a workflow to extract the keys or the values:

workflow getMapKeys {
    Map[String, String] map

    scatter(pair in map) {
        String value = pair.left
    output {
        Array[String] keys = value

I would prefer this to be a builtin function since otherwise I need to write this workflow for every type of map that I need it for. so for example, I actually need it for a Map[String,Map[String,Array[String]]]....

Is this in the works? Is there a better way to do this?



Sign In or Register to comment.