and more in a single search tool across platforms. Read the announcement here. |
08/21/2023 12:48 AM
Hi ,
we have a target attributes that need to be concatenated in a single user attribute
The target labels are not mutually exclusive , some have values and some do not
However , we tried by specifying as follows in importuser json
"street": "if(street1!=null || street2!=null) then #CONST#${String data1 = response.operation.Street1; String data2 = response.operation.Street2; ret = data1 + \" \" + data2; return ret}"
please specify what shall be the corrections to be made for this mapping
Regards,
Abdul Gaffar
08/21/2023 01:49 AM
Hi @Abdul_Gaffar,
You might need to import your street attributes in customproperties using one to one mapping and then leverage the MODIFYUSERDATAJSON attribute of your connector to update the data accordingly. The below code assumes street1 is mapped with customproperty1 and street2 is mapped with customproperty2. Once the street attribute is updated, it will empty the customproperties.
{
"ADDITIONALTABLES":{
"USERS":"SELECT DISTINCT username, customproperty1, customproperty2 FROM USERS",
},
"COMPUTEDCOLUMNS":[
"street",
"customproperty1",
"customproperty2",
],
"TABLEINDEXES":{
"CURRENTUSERS": [
"username"
],
},
"PREPROCESSQUERIES":[
"UPDATE NEWUSERDATA SET street = CASE WHEN customproperty1 is not null or customproperty2 is not null THEN CONCAT(customproperty1,' ',customproperty2) ELSE NULL END",
"UPDATE NEWUSERDATA SET customproperty1 = NULL, customproperty2 = NULL",
]
}
08/21/2023 03:01 AM
Thank you @adriencosson it is working
08/21/2023 03:06 AM
Glad it is working fine !
You can "Accept as Solution" the above answer 🙂