Expand my Community achievements bar.

SOLVED

dataPolicy constraint on a field

Avatar

Level 5

Hello All,

 

I need to enforce a constraint on a custom table for a Product Name field. The field should have the First Character as Caps. I added the dataPolicy="smartCase" to the element attribute while creating the same.

 

But when I update data for the field, it still shows in lowercase ( as the upload data ).

  • Is there a way to automatically change the case of the data, when its saved/updated in ACC ?
  • Is Datapolicy the right solution for this ? Any particular use case for dataPolicy ?

 

Regards,

DG

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @dipendu_g ,

Yes, adding dataPolicy="smartCase" to the attribute is correct. We can see the same in out of box Recipient schema for firstName, lastName.

 

<attribute dataPolicy="smartCase" label="Last name" name="lastName" type="string"/>
<attribute dataPolicy="smartCase" label="First name" name="firstName" type="string"/>

This dataPolicy="smartCase" makes first letter in CAPS for the string, when you try to insert data from like input form etc.
But when you try to insert it via update data activity, if the first letter is small in input file, then it will update in schema as first letter small.

 

So if you want to update first letter to be in CAPS, in update data activity, use this function Smart(productNameField)

 

Input File:

ParthaSarathy_0-1667899257993.png

Update Data Activity:

ParthaSarathy_1-1667899301268.png

In this case firstName alone get first letter as caps in schema

ParthaSarathy_2-1667899424361.png

 

View solution in original post

7 Replies

Avatar

Community Advisor

Hi @dipendu_g ,

 

You are doing it rightly as "dataPolicy" is the only option that will help you in this case:

dataPolicy (string): enables you to specify approval constraints on values allowed in the SQL or XML field. The values for this attribute are:

“none”: no value
“smartCase”: first letters upper case
“lowerCase”: all lower case
“upperCase”: all upper case
“email”: email address
“phone”: telephone number
“identifier”: identifier name
“resIdentifier”: file name


Just check if you have performed the ' update DB structure' step post declaring this dataPolicy in the attribute.  

Br,

Shubham

Avatar

Level 5

Hi Shubham,

 

I tried all the same. I still don't see the values automatically changing. Will the values change as per the dataPolicy, or it will give an error

 

Regards,

DG

Avatar

Community Advisor

Hi @dipendu_g ,

 

It depends on the type of data policy you using that results in whether it throws an error or automatically changes the value. For example: If you use dataPolicy = "email" then if you enter the wrong email format it will throw an error whereas in Recipient form when you try to create a recipient and add firstName in lower case it automatically converts it into smartCase. Now if you say that enabling the policy will convert existing data of the table to smartCase, well I think that it might not.

In your case try to create a form for your schema and then try to input the data in the smartCase field and see if it automatically changes or not.

Also, here's a demo video for dataPolicy that might be helpful to you:
https://helpx.adobe.com/campaign/classic/how-to/drop-down-datapolicy-and-visibleIf-in-acv6-partII.ht...

Br,

Shubham

Avatar

Correct answer by
Community Advisor

Hi @dipendu_g ,

Yes, adding dataPolicy="smartCase" to the attribute is correct. We can see the same in out of box Recipient schema for firstName, lastName.

 

<attribute dataPolicy="smartCase" label="Last name" name="lastName" type="string"/>
<attribute dataPolicy="smartCase" label="First name" name="firstName" type="string"/>

This dataPolicy="smartCase" makes first letter in CAPS for the string, when you try to insert data from like input form etc.
But when you try to insert it via update data activity, if the first letter is small in input file, then it will update in schema as first letter small.

 

So if you want to update first letter to be in CAPS, in update data activity, use this function Smart(productNameField)

 

Input File:

ParthaSarathy_0-1667899257993.png

Update Data Activity:

ParthaSarathy_1-1667899301268.png

In this case firstName alone get first letter as caps in schema

ParthaSarathy_2-1667899424361.png

 

Avatar

Level 2

Hi @ParthaSarathy / @Shubham_Goyal__ ,

I am trying to implement same logic for my case , but its not working , not sure what is wrong .

I have added the datapolicy in table :

<attribute dataPolicy="smartCase" label="CH First Name" length="100" name="cnsmr_first_nm"
type="string"/>

And when trying to upsert the table using update activity in the workflow , CAPS char is not changed into first letters upper case . 

Prady12_0-1691058046970.png

Could you check and help me to identify issue? 

 

Thanks!!!

Pradyumn

Avatar

Community Advisor

Hi @Prady12 ,

It should work. Hope you had updated the database, disconnect & reconnected.

But alternatively, you can try the below,

Use an enrichment activity before Update data, add expression and create Smart([target/@cnsmr_first_nm]) and give alias as @smartCaseCnsmr_first_nm

And in update data activity, map @smartCaseCnsmr_first_nm in source expression.

ParthaSarathy_0-1691069700877.png

 

Avatar

Level 2

Hi @ParthaSarathy ,

Thanks for quick response.

Table was not showing up for DB update structure after adding my dataPolicy="smartCase" in the attribute.

attribute where i added dataPolicy="smartCase" is extended table of nmsrecipient. does this cause any issue ?

 

Thanks!!!

Pradyumn