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
4402 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Can queryEntity be used to query nested CDTs...
meharig
over 9 years ago
Can queryEntity be used to query nested CDTs...
OriginalPostID-131865
OriginalPostID-131865
Discussion posts and replies are publicly visible
0
Eduardo Fuentes
Appian Employee
over 9 years ago
Please refer to the documentation
forum.appian.com/.../Data_Types.html
The constraints about children CDTs are mentioned there.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
chrisb481
over 9 years ago
Eduardo, can you please elaborate on this? I have a Parent CDT, with a child CDT of type multiple:
ParentCDT
--ChildCDT[Multiple]
--Field1
In above scenario, how do I access the data for Field1 for all (or any) instances of the ChildCDT? I am trying to create an entity backed record, but have found no way to access this. The two tables for the two CDTs are linked properly in my DB via a primary key.. but cannot use query rules, cannot use a!queryEntity(), tried local!childCDT.field1[index], no luck. Thank you very much.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 9 years ago
When building a record dashboard for example, in the context of the dashboard the "Child CDT [Multiple]" is a record field therefore you can access each item as follows (this example is for an Office (Parent CDT) with Multiple Office Locations (ChildCDT[Multiple]) where each office location has attributes such as a state:
rf!locations[ri!index].state
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 9 years ago
In terms of queryentity here's an example using that same scenario of the Company with Multiple Office Locations.
In this example I looking for company with id 1 and returning all its office locations
a!queryEntity(
entity: cons!COMPANY_ENTITY_TYPE,
query: a!query(
selection: a!querySelection(
columns: {
a!queryColumn(
field: "name"
),
a!queryColumn(
field: "locations"
)
}
),
filter: a!queryFilter(
field: "id",
operator: "=",
value: 1
),
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 1
)
)
).data.locations
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 9 years ago
If this query returned multiple results and I only wanted the state of the first location from the first company:
).data[1].locations[1].state
or all states for the first result in this query
).data[1].locations.state
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel