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
5 replies
Subscribers
7 subscribers
Views
1788 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Hi , i have 3 cdts namely A , B , C and three data store of the same i.e
himanshug
over 11 years ago
Hi ,
i have 3 cdts namely A , B , C and three data store of the same i.e .A,B,C . The relationships are A has one to many relationship with B and B has one to many relationship with C . While feeding the data into A and B . I used the cdt of type A and date store of type A and i was able to successfully populate my tables . Now while i am feeding data to C , i am using the data type of B (as B has one to many relation with C) and the data store of C . But it is giving me an error . How should i write to table C filling it foreign key which is of B ?...
OriginalPostID-80528
OriginalPostID-80528
Discussion posts and replies are publicly visible
0
Michael Tan
Appian Employee
over 11 years ago
See this documentation to see the one to many example:
forum.appian.com/.../Defining_a_Custom_Data_Type
Here is an example you can use:
<xsd:element maxOccurs="unbounded" name="testDataTypeC" type="test1234:test_data_type">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">
@OneToMany(cascade=ALL, indexed=false)
@JoinColumn(name="data_type_b_id", nullable=false)
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
In the above, since you aren't providing the definition of data type c in the same xsd, you will need to have this in your xsd. Please adjust the example accordingly.
<xsd:include schemaLocation="%7Bhttp%3A%2F%2Fwww.testing.com%2Fappian%test_data_type_c.xsd"/>
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
himanshug
over 11 years ago
@michael : i have already made the xsd's and the table are mapped , But while writing to the table c , i am seeing that the reference of B is not taken . How do i solve this issue of making an entry to the data source ?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Michael Tan
Appian Employee
over 11 years ago
Himanshu, check that your variables are actually saved properly in to the cdt variable you are using in your write to datastore node. Also, what is your xsd definition of type B? This might show why when you write to C it doesn't have a reference to B.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
himanshug
over 11 years ago
@michael : I made a single XSD wherein i made three CDT'S A,B,C . In this A has a one to many reference of B , B has a one to many reference of C (like you've shown) .I was successfully able to populate the tables A and B using cdt of A and filling into data store A . Now i am trying to populate the table C so i am using the cdt of type B and feeding into data store C so it is showing an error and when i tried to populate C using cdt of type C and feeding into data store C ,it populates but the reference of B isnt populated .
I hope i am able to explain my doubt
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Michael Tan
Appian Employee
over 11 years ago
Populating type B in to data store C won't work, as the type will need to match the data store entity.
Type C will only have references to B if it is written in to the database as a child of B. This is unless you control the foreign key relation in process by populating the foreign key yourself.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel