(Classic) Transform Key value pairs into separate columns | Community
Skip to main content
Level 2
August 13, 2021
Solved

(Classic) Transform Key value pairs into separate columns

  • August 13, 2021
  • 2 replies
  • 1282 views

Hi,

I have a question regarding changing typical JSON key-value pairs into DB columns.

Here's the data schema I'm currently trying to transform:

user channel optstatus

1Emailtrue
1SMSfalse
2Emailtrue
2SMStrue
3Emailfalse
3SMStrue

 

I want to take the value pairs from "channel" and "optstatus" and create a new column in the data schema that would be fed with its values, something like this:

user channel optstatus Email SMS

1Emailtruetruefalse
1SMSfalsetruefalse
2Emailtruetruetrue
2SMStruetruetrue
3Emailfalsefalsetrue
3SMStruefalsetrue

 

Or to simplify something like that would be also good:

user Email SMS

1truefalse
2truetrue
3falsetrue

 

I don't wanna change the already-existing structure of the data schema apart from adding new columns. Would I do it in a workflow, query and enrichment, or do some SQL filtering? I would really appreciate your help. Cheers!

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 Kishore_Padamata

Hello @piotrko2 
Please try below approach:
-> [split] Split by channel

-> [enrichment] set @emailOPT with optstatus (the inbound transition value)

-> [enrichment] set @smsOPT with optstatus (the inbound transition value)
-> [union] chose selection of columns for reconciliation. set user as reconciliation key.


Hope this helps!

2 replies

david--garcia
Level 10
August 13, 2021

Can you elaborate more? whats your end goal? also, is your source schema custom? or ootb?

PiotrKo2Author
Level 2
August 16, 2021

My goal is to have columns with unique attributes and their values - currently, I'm getting key-value data through SOAP calls and that JSON-like structure is unnecessarily more complex to work with when it comes to applying rules, filters etc.

 

The data schema I'm referring to is custom.

Kishore_Padamata
Adobe Employee
Kishore_PadamataAdobe EmployeeAccepted solution
Adobe Employee
August 19, 2021

Hello @piotrko2 
Please try below approach:
-> [split] Split by channel

-> [enrichment] set @emailOPT with optstatus (the inbound transition value)

-> [enrichment] set @smsOPT with optstatus (the inbound transition value)
-> [union] chose selection of columns for reconciliation. set user as reconciliation key.


Hope this helps!

PiotrKo2Author
Level 2
August 26, 2021

This is exactly what I was looking for! Thank you, kishorep, this is invaluable!