I am new one to adobe campaign classic it is possible to create more than one primary key in custom schema?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hello @Kumar_27
Yes, you can create a composite key in AC.
Here is an example:
<key internal="true" name="id">
<keyfield xpath="@field1"/>
<keyfield xpath="@field2"/>
</key>
Hello @Kumar_27
Yes, you can create a composite key in AC.
Here is an example:
<key internal="true" name="id">
<keyfield xpath="@field1"/>
<keyfield xpath="@field2"/>
</key>
@Kumar_27 , Yes you can create a composite primary key by using the above syntax provided.
In structure, you can see PK symbol as below
If field1 & field2 is your composite primary key, and when you insert values for field1 and field2 as a-a, then a-b, b-a, and b-b, it will accept. But when you try to add b-b again, it will throw error '1 record(s) already exist in the database'
@ParthaSarathy thanks a lot for your clear explanation.
Hi @Kumar_27 ,
If you want , you can create the Combination of Columns what you want as the Primary key which is called as Composite Key in Adobe Campaign.
Syntax:
<key name="PrimaryKeyInternalName" internal="true">
<keyfield xpath="@column1"/>
<keyfield xpath="@column2"/>
</key>
Please find the documentation for reference:
Regards,
Pravallika.
Hi Preeth,
The short answer to your question is no. However, this is not a product limitation but a standard practice for databases in general.
You can use a combination primary key, combining two fields to create a unique key. You can also have foreign keys, which are primary keys from other tables linked to your table.
I recommend walking through the developer documentation section in the Campaign documentation before diving into any schema changes. Additionally, if you are new to database management/development, then I would recommend leveraging your database's website documentation as all databases have their own syntaxes and nuances that can greatly impact performance.
Views
Replies
Total Likes