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
11 replies
Subscribers
9 subscribers
Views
4689 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Lets say I have a table name that exists in my database and I store it on a loca
erickp
over 9 years ago
Lets say I have a table name that exists in my database and I store it on a local variable. Is there any way to associate that table with its already created CDT?
OriginalPostID-192431
OriginalPostID-192431
Discussion posts and replies are publicly visible
0
Tim
Certified Lead Developer
over 9 years ago
Not through expressions no. Although if you're returning meta data such as table names you might as well store the cdt name in your database somewhere. I can't think of a practical way to use this though... you're the king of ill-fitting requirements! ;-) Your requirements sound like you're keeping much of the system logic in the database such as validations etc. I've done this before with Appian and ended up with a web service layer with all the intelligence and a very empty Appian solution - not a great fit.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sumeet Khare
over 9 years ago
If you are using data store then you can create a data store entity constant and then you can use that constant
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jackm829
A Score Level 3
over 9 years ago
Hi Erick, you can use an @Table annotation in the .xsd file that defines the already created CDT. That tells Appian that the CDT should map to the table. Add the CDT as a data store entity in a data store and click "verify". You will learn whether the CDT "maps", or corresponds exactly, to the table. Go here for a listing of JPA Annotations that we can use in our .xsd files that define CDTs:
forum.appian.com/.../Defining_a_Custom_Data_Type.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
erickp
over 9 years ago
Jack, thanks for the answer. How would I be able to use the @Table annotation within SAIL or process flow to figure out what the CDT is for a given String (table name)?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
narasimhaadityac
A Score Level 2
over 9 years ago
@erick, We can't have the annotation inside the SAIL component, we can defined multiple CDT's per each table and depending upon the input we can try to assign respective CDT type.. if you need to dynamically assign the local variable the use the type() constructor to assign to multiple CDT types.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
erickp
over 9 years ago
So there is no way that given a String (table name), I can know what CDT is mapped to? And that table name is already created in the database.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
narasimhaadityac
A Score Level 2
over 9 years ago
as per my knowledge no.. the typeof(), typename() would give for Appian system data types but not CDT's.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
erickp
over 9 years ago
What I am trying to do is to dynamically get the entity parameter for the function a!queryEntity(). Is there any way of doing that?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
narasimhaadityac
A Score Level 2
over 9 years ago
yes you can do this if you have predefined CDT, Data Stores defined, you can pass the entity as well as a parameter, defined constants of type Data Store Entity, one for each and using if else condition pass it.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
@erickp I don't think that's possible OOTB. It might be worth trying to maintain the fact that a database table is associated with a particular datastore entity constant, in the database itself. This relationship will help you in obtaining a data store entity for a given table name. Off-course, you can also maintain this relationship in the expression rules.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>