How to properly get multiple tags with GetDevicesWithTags? With Feedback.

This is both a question and feedback!

Question: How do we get multiple tags using GetDevicesWithTags?

Currently you can GetDevicesWithTag easily like so:

MyDevice := GetDevicesWithTag( MyTag{} ).

This works nicely, however its not clear how to get multiple tags! First, we need a new function. I don’t believe 2 seperate functions should be needed, instead keep a single function of GetDevicesWithTags that works with both single and multiple tags.

The cleanest and most logical way for me to do this would be like so:

For a single tag:
MyTaggedDevice := GetDevicesWithTags( array = { MyTag1{} } )
For multiple tags:
MyTaggedDevices := GetDevicesWithTags( array = { MyTag1{}, MyTag2{} } )

Hi,

To query for objects in more complex ways than just using a single tag the way to do it is currently using the GetCreativeObjectsWithTags function with a tag_search_criteria:

# All creative objects with MyTag1
ObjectsWithMyTag1 := GetCreativeObjectsWithTag( MyTag1{} )

# All creative objects with MyTag1 AND MyTag2
ObjectsWithMyTag1AndMyTag2 := GetCreativeObjectsWithTags(tag_search_criteria{RequiredTags := array{MyTag1{}, MyTag2{}}})

# All creative objects with MyTag1 OR MyTag2
ObjectsWithMyTag1OrMyTag2 := GetCreativeObjectsWithTags(tag_search_criteria{PreferredTags := array{MyTag1{}, MyTag2{}}})

# All creative objects with MyTag1 OR MyTag2 that do NOT have MyTag3
ObjectsWithMyTag1ORMyTag2ButNotMyTag3 := GetCreativeObjectsWithTags(tag_search_criteria{PreferredTags := array{MyTag1{}, MyTag2{}}, ExclusionTags := array{MyTag3{}}})

, given tags defined like this:

MyTag1 := class(tag):

MyTag2 := class(tag):

MyTag3 := class(tag):

. Note that what used to be called GetCreativeDevicesWithTag is called GetCreativeObjectsWithTag in future releases. We will take your feedback regarding just having one function into consideration.

// K

4 Likes

Thank you for the response!