Hello there,
I created a view and CDT on top it. Data store is failing to verify and Publish the new entity.
Below is the received error:
Added XSD for reference
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:com:appian:types:FAS" targetNamespace="urn:com:appian:types:FAS"> <xsd:complexType name="FAS_VW_getWorkDataReport"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Table(name="FAS_VW_GET_WORK_REPORT")</xsd:appinfo> <xsd:documentation><![CDATA[FAS_VW_getWorkDataReport]]></xsd:documentation> </xsd:annotation> <xsd:sequence> <xsd:element name="count" nillable="true" type="xsd:int"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="COUNT", columnDefinition="INT")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="username" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="USERNAME", columnDefinition="VARCHAR(500)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="action" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="ACTION", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="datetime" nillable="true" type="xsd:dateTime"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="DATETIME", columnDefinition="DATETIME")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="caseId" nillable="true" type="xsd:int"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="CASE_ID", columnDefinition="INT")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="clientType" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="CLIENT_TYPE", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="transactionType" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="TRANSACTION_TYPE", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="transactionSubType" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="TRANSACTION_SUB_TYPE", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="task" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="TASK", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="caseStatus" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="CASE_STATUS", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="createdBy" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="CREATED_BY", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="createdDateTime" nillable="true" type="xsd:dateTime"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="CREATED_DATE_TIME", columnDefinition="DATETIME")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="updatedBy" nillable="true" type="xsd:string"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="UPDATED_BY", columnDefinition="VARCHAR(255)")</xsd:appinfo> </xsd:annotation> </xsd:element> <xsd:element name="updatedDateTime" nillable="true" type="xsd:dateTime"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Column(name="UPDATED_DATE_TIME", columnDefinition="DATETIME")</xsd:appinfo> </xsd:annotation> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:schema>
Please suggest!!
Also DDL is asking to update this view which is not appropriate: DDL below
/* UPDATE DDL */ alter table `FAS_VW_GET_WORK_REPORT` add column a_id bigint not null;
Discussion posts and replies are publicly visible
Appian requires that each CDT has a unique key. If you do not provide a key, it tries to create a field named "a_id". Modify the CDT and make a unique field the primary key.
Such as, your CASE_ID field (if it is unique):
<xsd:element name="caseId" nillable="true" type="xsd:int"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Id @Column(name="CASE_ID", columnDefinition="INT NOT NULL")</xsd:appinfo> </xsd:annotation> </xsd:element>
Otherwise you can add a new unique row to your view with something such as (example from MSSQL):
SELECT TOP (100) PERCENT ROW_NUMBER() OVER (ORDER BY id DESC) AS [Row], [status], [step], [requestNumber] from tblCOE_SAMPLE_TABLE
Additionally, typically for such calculated columns in views we will have to define as BIGINT in the CDT:
<xsd:element name="Row" nillable="false" type="xsd:int"> <xsd:annotation> <xsd:appinfo source="appian.jpa">@Id @Column(columnDefinition="BIGINT NOT NULL")</xsd:appinfo> </xsd:annotation> </xsd:element>
Hello Chris, thanks for quick response and i updated with Primary Key as needed.
Thank you