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
8 replies
Subscribers
9 subscribers
Views
4123 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Is there any way to retrieve the fields of CDT and store in a variable (multiple
Amit Mishra
over 8 years ago
Is there any way to retrieve the fields of CDT and store in a variable (multiple type)? Scenario: I have to fetch all the fields of CDT (like- EmpId, EmpName, DOJ etc.) and showed them in a drop down options of a form interface.
OriginalPostID-221268
OriginalPostID-221268
Discussion posts and replies are publicly visible
0
Jacob Cohen - Project Leader - Macedon Technologies
over 8 years ago
index(ri!cdt, "EmpId", {}) or ri!cdt.EmpId should do it.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
Hi Amit, I have one approach - tested and it works.
Use the following expression:
fn!split(fn!stripwith(fn!tostring(type!CDT_NAME()) , "=[]"),",")
where CDT_NAME is the name of your CDT - like Employee_CDT.
This will return you a list of text - each element in the list will be a field in the CDT.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
If your CDT contains field called EmpId, EmpName, DOJ - all those names will be returned in a list of text.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Amit Mishra
over 8 years ago
Thanks Chetan. It's working.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mohammedz
Certified Senior Developer
over 8 years ago
@amit
Yes we can do it . Call a queryentity to a particular table if CDT is mapped to database or pass the Cdt into interface rule of anytype
Scenario 1:(cdt has duplicate values but I need take unique and show in dropdown)
To do so use queryentity and fetch the data and store it in a local variable. Using union or intersection function u can pick the unique values. And now in dropdown field you can use like the below
choiceLabels:local!variable
choice Value:local!variable
Scenario2 :(subset or cry itself has unique data)
This is something straight forward and you can fetch data and store in a local variable. Pass that local variable as said above
Hope this helps ...!!!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mohammedz
Certified Senior Developer
over 8 years ago
@amit
Yes we can do it . Call a queryentity to a particular table if CDT is mapped to database or pass the Cdt into interface rule of anytype
Scenario 1:(cdt has duplicate values but I need take unique and show in dropdown)
To do so use queryentity and fetch the data and store it in a local variable. Using union or intersection function u can pick the unique values. And now in dropdown field you can use like the below
choiceLabels:local!variable
choice Value:local!variable
Scenario2 :(subset or cry itself has unique data)
This is something straight forward and you can fetch data and store in a local variable. Pass that local variable as said above
Hope this helps ...!!!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Josh
Certified Lead Developer
over 8 years ago
@chetany instead of using "=[]" you should use "=[] ". This will eliminate leading spaces in the field names
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chetany
A Score Level 1
over 8 years ago
@joshl, correct. I agree with you.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel