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
17 replies
Subscribers
7 subscribers
Views
7900 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Hi All, I have a CDT rule input of type "Any Type" called r
aswinb
over 11 years ago
Hi All,
I have a CDT rule input of type "Any Type" called ri!companyContact. I am trying to pass this rule input to a textField's value field. There is a nested CDT inside this CDT. I am actually trying to store the value into one of those fields inside the inner CDT. But it is giving an error saying "Cannot index property "CompanyContactDetails" of type Text into type Text" where inner CDT is called "CompanyContactDetails".
This is the code:
a!textField(
label:"",
value: ri!companyContact.CompanyContactDetails.DetailTypeId,
saveInto: ri!companyContact.CompanyContactDetails.DetailTypeId
)
Can anybody help on this issue?...
OriginalPostID-107781
OriginalPostID-107781
Discussion posts and replies are publicly visible
0
jesse.triplett
Appian Employee
over 11 years ago
Seems to indicate to me that ri!companyContact is not seen as a CDT. Did you verify that the rule input is "any type" as well as the ac! in the user input node?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aswinb
over 11 years ago
Yes it's of type Anytype and the ac and pv that's being mapped to the top is of the actual CDT type....the thing is on the interface designer it works but when I am trying to test the rule it gives an error called "Cannot index property ComanyContactDetails of type text into type text".
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jesse.triplett
Appian Employee
over 11 years ago
If you just put ri!companyContact in the value field, do you see the whole structure of the CDT?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aswinb
over 11 years ago
the thing is I am taken this rule outside and testing it by itself. RIght now I am not mapping it into any ac's or pv's. I am trying to test it out in an expression editor and it works if I just put the CDT name itself in the value and saveInto fields. But whenever I put a dot operator and the inner CDT name, that's when it complains. I thought if you have a rule input of type anytype it can expect a dot operator.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jesse.triplett
Appian Employee
over 11 years ago
If you didn't pass in the CDT it will not work. It cannot find that field because it doesn't exist. You could use the index() instead of dot notation when reading out of the CDT for a more robust expression.
a!textField(
label:"",
value: index(index(ri!companyContact,"CompanyContactDetails",{}),"DetailTypeId",{}),
saveInto: ri!companyContact.CompanyContactDetails.DetailTypeId
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aswinb
over 11 years ago
I can only specify the CDT rule input inside the expression editor to be any of the default types such as Integer, text, datetime, anytype.....since it's a CDT, I am making it of type "AnyType". But this expression editor rule is being passed into a user input form with ac's of actual CDT type and then into pv's of actual CDT type. But it's giving a java script error when I try to view it in tempo. The UI appears in Interface Designer but it doesn't work in the Tempo. When I hit test rule on this particular rule in expression editor, I am getting this error called "Cannot index property "CompanyContactDetails of type Text into type Text". I tried using your nested index function as well but it still gives the same error. Can u help?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aswinb
over 11 years ago
I am trying to capture the data from the textbox and store it in CDT and then store to database using Write to datastore entity....
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jesse.triplett
Appian Employee
over 11 years ago
Yes, it should be AnyType but when you click test the expression a box comes up for the rule input so when you don't pass in the structured data, it can't find the field. If you post your SAIL code for the whole form, perhaps I can spot something. Otherwise, it sounds like the form is fine (it works in interface designer) and the issue is with how the CDT's are passed in the process.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
aswinb
over 11 years ago
Here's the whole code:
load(
local!detailType:if(rule!COMMON_IsNullOrEmpty(rule!DCMIFS_GetDetailType()), {},rule!DCMIFS_GetDetailType()) ,
a!sectionLayout(
label:"Details",
firstColumnContents:{
a!textField(
label:"Phone Number",
value:index(index(ri!companyContact1, "CompanyContactDetails", {}), "Value", {}),
saveInto:ri!companyContact1.CompanyContactDetails.Value
),
a!dropdownField(
label:"Detail Type",
placeholderLabel:cons!DCMIFS_DROPDOWN_PLACEHOLDER_LABEL,
choiceLabels: rule!APN_distinct(local!detailType.DetailType),
choiceValues: rule!APN_distinct(local!detailType.DetailTypeId),
value:index(index(ri!companyContact1, "CompanyContactDetails", {}), "CompanyContactDetailId", {}),
saveInto:ri!companyContact1.CompanyContactDetails.CompanyContactDetailId
),
a!textField(
label:"Email",
value:index(index(ri!companyContact2, "CompanyContactDetails", {}), "Value", {}),
saveInto:ri!companyContact2.CompanyContactDetails.Value),
a!dropdownField(
label:"Detail Type",
placeholderLabel:cons!DCMIFS_DROPDOWN_PLACEHOLDER_LABEL,
choiceLabels: rule!APN_distinct(local!detailType.DetailType),
choiceValues: rule!APN_distinct(local!detailType.DetailTypeId),
value:index(index(ri!companyContact2, "CompanyContactDetails", {}), "CompanyContactDetailId", {}),
saveInto: ri!companyContact2.CompanyContactDetails.CompanyContactDetailId
),
a!textField(
label:"Website",
value:index(index(ri!companyContact3, "CompanyContactDetails", {}), "Value", {}),
saveInto:ri!companyContact3.CompanyContactDetails.Value
),
a!dropdownField(
label:"Detail Type",
placeholderLabel:cons!DCMIFS_DROPDOWN_PLACEHOLDER_LABEL,
choiceLabels: rule!APN_distinct(local!detailType.DetailType),
choiceValues: rule!APN_distinct(local!detailType.DetailTypeId),
value:index(index(ri!companyContact3, "CompanyContactDetails", {}), "CompanyContactDetailId", {}),
saveInto: ri!companyContact3.CompanyContactDetails.CompanyContactDetailId
),
a!textField(
label:"Twitter Hashtag",
value:index(index(ri!companyContact4, "CompanyContactDetails", {}), "Value", {}),
saveInto:ri!companyContact4.CompanyContactDetails.Value),
a!dropdownField(
label:"Detail Type",
placeholderLabel:cons!DCMIFS_DROPDOWN_PLACEHOLDER_LABEL,
choiceLabels: rule!APN_distinct(local!detailType.DetailType),
choiceValues: rule!APN_distinct(local!detailType.DetailTypeId),
value:index(index(ri!companyContact4, "CompanyContactDetails", {}), "CompanyContactDetailId", {}),
saveInto: ri!companyContact4.CompanyContactDetails.CompanyContactDetailId
),
a!paragraphField(
label:"Location Notes",
value:"",
saveInto:""
)
})
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
jesse.triplett
Appian Employee
over 11 years ago
Is there a place where you have a!formLayout(firstColumnContents:{}) around this? If not, that's where you should start
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>