Hi,
we have data from query entity rule like
{{cText:"one",typeId:1},{cText:"two",typeId:2},{cText:"three",typeId:3}} from this ,we need to extract the required cText by passing the typeId.
Is there any direct way by using the array function in appian extract.
Thanks in advance.
Discussion posts and replies are publicly visible
You can use the function displayvalue for it. Goes something like displayvalue(ri!typeId, local!array.typeId, local!array.cText, null)
As per Stefan's response, displayValue will work but only if your use case is to find a unique value of typeId. If the values of typeId can appear more than once then displayValue will only return the first occurrence. If you want to return ALL occurrences of cText for a given typeId then you'll need to take a different approach:
load( local!myData: {{cText:"one",typeId:1},{cText:"two",typeId:1},{cText:"three",typeId:3}}, fn!index( fn!index(local!myData,"cText",null), wherecontains(ri!typeId, fn!tointeger(fn!index(local!mydata,"typeId",null)) ) ) )
Thanks... it solved our issue.
Thanks for the reply. sure will take are of the repeated values.
load( local!myMap: { a!map(rollNumber:1,firstName:"something1"),a!map(rollNumber:2,firstName:"something2")}, displayvalue(ri!rollNumber, local!myMap.rollNumber, local!myMap.firstName, null) )
why load()? That's an antique function....
no it's not, you can check it in documentation and it's quite helpful
load is old .https://docs.appian.com/suite/help/21.4/fnc_evaluation_load.htmlThere is a reason for this box.
it is the same situation likeapply() & a!applycomponenst() and the newer a!forEach():isnull and a!isNullOrEmpty() and so on
yeah, a!localvariables is working better.