Expand my Community achievements bar.

SOLVED

Read Audience conditionally and extract the name from filename.

Avatar

Level 3

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.

1 Accepted Solution

Avatar

Correct answer by
Level 3

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.

View solution in original post

18 Replies

Avatar

Level 6

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

johnwwilcoxmba_0-1643382311580.png

 

Avatar

Level 3

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

Avatar

Correct answer by
Level 3

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.

Avatar

Employee Advisor

Unfortunately there is nothing better available at the moment

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

Avatar

Employee Advisor

ok, what you could do on that part:

  • use an enrichment to look up if the segment exists
  • then split up the workflow depending on the "new" or "update" paths

This is what my flow currently looks like.

I don't know how I can read the audience only if it exists and do different things depending on if it exists.

 

Also, I'm having the issue, that the union is failing. I'm not sure how I can modify this in a way that the unioning is only done if there is an existing audience.

 

Screenshot 2022-02-01 at 14.32.28.png

Avatar

Employee Advisor

Hi Benedikt,

what you could do:

  • First use a "Save audience" with the name and choose "Complete the audience". This will store all users (including deleted) in the audience
  • Then use a fork to read the audience again (including all people which were there before already) and exclude those to be removed and save it again.
  • With that it's ensured that the audience exists in the 2nd step

Hi Ramon,

 

thanks for the suggestion. Could be a good approach.

 

The only issue I'm worried about that solution is, that on sending out the audience might be off for a moment.

 

But with batch audiences, everything is about timing anyways. Can I somehow block send-outs to the audience while the workflow is still running to be 100% safe?

 

Best

 

Benedikt

Avatar

Employee Advisor

Unfortunately no.

 

To ensure that option you would need a more complicated workflow:

* Use enrichment to search for the audience

* then do a segmentation with "enable only with data" option for the 2 paths (check if audience is found)

* If found, use the read + update way

* If not, just use Save audience

Avatar

Employee Advisor

You can't read the full audience dynamically.

Indeed my text was a bit wrong. You would use Reconciliation to search for the audience by name

Then in a segmentation you can check if it was found

I'm not sure how I can use reconciliation, to search an audience by a file name.

Avatar

Employee Advisor
  • add reconciliation activity
  • go to relations tab
  • add a new relation to audience schema
  • then add a join condition on label/name
  • Afterwards you could add a segmentation and check if additional data .-> audience -> ID is "not empty", then the audience was found

The issue is that I cannot select the filename as a source for the join.

 

It only has fields available from inside the CSV file. Is there a way to make the filename available as a field?

Screenshot 2022-04-29 at 09.02.18.png

Avatar

Employee Advisor

you could define a new field using the enrichment and set it to 

$(vars/@filename

Then you could use there