Read Audience conditionally and extract the name from filename. | Community
Skip to main content
benedikt-buchert
Level 2
January 28, 2022
Solved

Read Audience conditionally and extract the name from filename.

  • January 28, 2022
  • 2 replies
  • 4181 views

Hi everyone,

 

How can I read an audience dynamically and only combine it with data read from a file if there is an existing audience? Otherwise, I would want to create a new audience from the file.

 

Two challenges:

  • I would want to extract the Audience name from the file name via a regex. The regex should be as follows:
    Something_[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}_(\w+)_[0-9]{8}_[0-9]{6}\.csv where $1 is the audience name.
  • If the audience already exists I would want to read that audience and combine it with the data read from a file. The file should be identified by that same regex.
    If the Audience does not exist yet I would want to create a new one.

 

  • How do I do a regex to extract the name from the file?
  • How do I read the audience dynamically and union with the file data only if the audience exists?

Maybe I'm doing it all wrong but I want to pass an Audience from a Segment in Adobe Experience Platform.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by benedikt-buchert

Currently helping myself with: 

Replace(Replace(Replace(FileName($(vars/@filename)),Left(FileName($(vars/@filename)),52),''),Right(FileName($(vars/@filename)),52),''),'_',' ')

Which is kind of nerve wrecking.

2 replies

Level 5
January 28, 2022

This may not answer your question, but couldn't you do something like this?

 

benedikt-buchert
Level 2
January 29, 2022

Unfortunately Like does not serve my case, as the name of the audience can be different each time.

benedikt-buchert
benedikt-buchertAuthorAccepted solution
Level 2
January 31, 2022

Currently helping myself with: 

Replace(Replace(Replace(FileName($(vars/@filename)),Left(FileName($(vars/@filename)),52),''),Right(FileName($(vars/@filename)),52),''),'_',' ')

Which is kind of nerve wrecking.

Adobe Employee
February 1, 2022

Unfortunately there is nothing better available at the moment

benedikt-buchert
Level 2
February 1, 2022

Thank you so part 1 is solved. And only the second part about unionizing remains to be solved.