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
8 subscribers
Views
2847 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I am having troubles with this bit of code: index( ri!arrayOfCom
mokhtarc970
over 9 years ago
I am having troubles with this bit of code:
index(
ri!arrayOfComponent,
wherecontains(
ri!arrayOfProduct[ri!index].id,
ri!arrayOfComponent.FK_productId
),
{}
),
It generates an error for which I don't really get the reason
a!applyComponents [line 25]: Invalid index: Cannot index property 'FK_productId' of type Text into type List of Variant
this FK_productId is an Integer type in the arrayComponent CDT so I don't understand why it says it is a text.
I've tryed tointeger and tostring casts to solve with no result
thanks
OriginalPostID-207016
OriginalPostID-207016
Discussion posts and replies are publicly visible
Parents
0
monikar
over 9 years ago
As mentioned null handling is very important when accessing any fields of a CDT or any type variable.
But In few cases upon applicability and the requirement it is always better to use index function with default value present to access fields in CDT.
Ex: In the above code if you want to get the result even when ri!arrayOfComponent is empty then using index function with default value would be more helpful rather than completely skipping the code using null handling.
index(
ri!arrayOfComponent,
wherecontains(
ri!arrayOfProduct[ri!index].id,
index(ri!arrayOfComponent, "FK_productId", null)
),
{}
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
monikar
over 9 years ago
As mentioned null handling is very important when accessing any fields of a CDT or any type variable.
But In few cases upon applicability and the requirement it is always better to use index function with default value present to access fields in CDT.
Ex: In the above code if you want to get the result even when ri!arrayOfComponent is empty then using index function with default value would be more helpful rather than completely skipping the code using null handling.
index(
ri!arrayOfComponent,
wherecontains(
ri!arrayOfProduct[ri!index].id,
index(ri!arrayOfComponent, "FK_productId", null)
),
{}
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data