Solved
Replace an empty string with N/A in journey
We are trying to do a replace of an empty attribute in the client profile with N/A in a custom action in a journey. We tried replace and replaceAll but neither gave us the solution we needed.
REPLACE
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(replace(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName},'','NA'), ' ')
, replace(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName},'', 'NA') )
, ' is customer since ' )
, replace(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.customerSinceDate}),'','NA'))
, ' has home at ')
, replace(#{ExperiencePlatform.ProfileFieldGroup.profile..homeName}, '', 'NA'))
, ' has potential total assets of ')
, replace(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.TotalAssetAmount}), '', 'NA'))
, ' has active acct ending with ')
, replace(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.all(#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).productCode}=='XXX'
and #{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).accountType}=='XXX'
and (in(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.at(0).accountStatusCode}, ['A', 'N']))).at(0).acctLast4}, '', 'NA'))
, ' opened on ')
, replace(toString(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.all(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.at(0).productCode}=='XXX'
and #{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountType}=='XXX'
and (in(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountStatusCode}, ['A', 'N']))).at(0).accountOpenDate}), '', 'NA'))
OUTPUT - Putting NA in from of everything
NATEST NATEST is customer since NA2023-12-13has home at NAHUBER HEIGHTS has potential total assets of NA67235 has active acct ending with NA7352 opened on NA2023-12-13
REPLACE ALL - Putting NA over and over
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(
concat(replaceAll(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName},'','NA'), ' ')
, replaceAll(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName},'', 'NA') )
, ' is customer since ' )
, replaceAll(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.customerSinceDate}),'','NA'))
, ' has home at ')
, replaceAll(#{ExperiencePlatform.ProfileFieldGroup.profile..homeName}, '', 'NA'))
, ' has potential total assets of ')
, replaceAll(toString(#{ExperiencePlatform.ProfileFieldGroup.profile.TotalAssetAmount}), '', 'NA'))
, ' has active acct ending with ')
, replaceAll(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.all(#{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).productCode}=='XXX'
and #{ExperiencePlatform.ProfileFieldGroup.profile._accounts.at(0).accountType}=='XXX'
and (in(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.at(0).accountStatusCode}, ['A', 'N']))).at(0).acctLast4}, '', 'NA'))
, ' opened on ')
, replaceAll(toString(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.all(#{ExperiencePlatform.ProfileFieldGroup.profile..accounts.at(0).productCode}=='XXX'
and #{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountType}=='XXX'
and (in(#{ExperiencePlatform.ProfileFieldGroup.profile.accounts.at(0).accountStatusCode}, ['A', 'N']))).at(0).accountOpenDate}), '', 'NA'))
OUTPUT
NADNAANARNARNAENALNA NASNATNARNAINACNAKNALNAINANNAGNA is customer since NA2NA0NA2NA3NA-NA1NA2NA-NA2NA1NA has home at NAWNAENASNATNA NAHNAANARNATNAFNAONARNADNA NABNARNAANANNACNAHNA has potential total assets of NA7NA3NA6NA1NA5NA6NA has active acct ending with NA8NA3NA5NA7NA opened on NA2NA0NA2NA3NA-NA1NA2NA-NA2NA1NA
Would like the output to looking like this
JOHN SMITH is customer since 2023-12-18 has home at WEST TUSC has potential total assets of N/A has active account ending with 1234 opened on 2023-12-19