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
2317 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
I'm annotating a CDT to set it up as a datastore entity. One of t
Jason Ruvinsky
Certified Lead Developer
over 11 years ago
I'm annotating a CDT to set it up as a datastore entity.
One of the fields of the CDT is essentially an enumeration. It will contain a text value in the CDT, but in the database this text value maps to a reference table, and the id that matches it needs to go into the table the CDT is linking to (it is a foreign key). While this is simple enough to set up with queries, I'm looking for some advice on how to set up the CDT annotations so that it will work with query rules and write to datastore entities....
OriginalPostID-91831
OriginalPostID-91831
Discussion posts and replies are publicly visible
0
Sathya Srinivasan
Appian Employee
over 11 years ago
Architecturally, you can either map this as a foreign key in your CDT using @onetoone annotation OR you can control the info that gets entered in this field from the front end by populating the field via a drop down that pulls value from the reference table.
Either way, it is recommended that the drop down value in the UI is pulled from the reference table for consistency.
Hope this helps.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jason Ruvinsky
Certified Lead Developer
over 11 years ago
I was planning to do the @onetoone, but the issue is that it will need to grab the id and use that when it writes to datastore. Is that possible, or will I need to add a step to use a query rule to get the id, and then insert it?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sathya Srinivasan
Appian Employee
over 11 years ago
of course. You can map the reference table as a CDT as well and use a QR to pull the data. You should get both the ID as well as the description.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jason Ruvinsky
Certified Lead Developer
over 11 years ago
Thanks Sathya. We're investigating the options now.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jason Ruvinsky
Certified Lead Developer
over 11 years ago
FYI, in this case we ended up just replacing the text enum with the table id in the CDT, and setting up constants for each id.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel