Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
7 subscribers
Views
3401 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Integrations
Team, I have a database view already created. I am now trying to crea
Manikandan Ganapathy
over 9 years ago
Team,
I have a database view already created. I am now trying to create a data type & data store in appian designer so that i can query the database using a!queryentity().
But it doesn't allow me stating that a_id is missing as it is the primary key. How i need to add this in the XSD file so that no new tables will be created?
OriginalPostID-162993
OriginalPostID-162993
Discussion posts and replies are publicly visible
0
neelimaj
over 9 years ago
Define a primary key to the cdt xsd file using @id to define primary key.. If you do not define any primary key.. Appian automatically creates a primary key with name a_id.. Remove the previous table and publish the xsd again with primary key defined..
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
@manikandang You need to do two things here:
1. Provide the name of the database view to the 'name' attribute of @Table annotation.
2. Provide the name of the column (which ever you feel is sufficient to uniquely identify a record) in your view to the 'name' attribute of the @Column annotation and designate this element with @Id annotation.
Also please remember that there may not be a need to drop the view (Assuming that a working View is in place) because if the XSD doesn't map to the database entity it means that there is a problem with XSD, and we should try rectifying the problem in same.
Here's an example of how you may do it:
@Table(name="nameOfDatabaseView")
@Id @Column(name="nameOfUniqueIdColumnInDatabaseView")
\ t<--\tOther columns goes here\t-->
And if you didn't make a search prior to posting, I would like to suggest to do so, as I remember there are some posts which resembles your query.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jacob Cohen - Project Leader - Macedon Technologies
over 9 years ago
Here's a link to some documentation on creating your XSD:
forum.appian.com/.../Custom_Data_Types_from_XSD.html
Check out the "<xsd:element name="id" type="xsd:int">" tag for an example of a primary key definition.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
senthilar
over 9 years ago
This is what we do to overcome this issue:
1) Add rownum as a column in the view (eg CREATE VIEW <viewname> AS SELECT rownum ROW_ID, <other required columns>...)
2) In XSD, use @Table annotation to point to this View and designate the ROW_ID column with @Id annotation
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel