Skip to main content
Inspiring
Oct 3, 2022 10:46 AM UTC
Question

index and where contains not working in process model

Hi,

have created one rule which called from process model. but it does not return any value.

need to filter values from pv.

The rule has index and where contains

3 replies

amans0009
Participating Frequently
Oct 3, 2022 11:03 AM UTC

It can be .. if where contains is returning list of integers - 0 items (the data which you are trying to find is not present in the array) ... hence the index function is not returning any value
please look at this code

a!localVariables(
  local!data:{a!map(id:1,data:"aman")},
  local!data2:{"a","b","c"},
  index(local!data2,wherecontains(2,local!data.id),null)
) //id:2 is not present in the data and 
   // the where contains will return list of number integers 0 items
   //code will goes as
    //  index(local!data2,tointeger({}),null)
    //   which will return list of text string 0 items


Inspiring
Oct 3, 2022 11:10 AM UTC

No it has values to return

harshitb6843
Brainy
Oct 3, 2022 12:04 PM UTC

Why would you call pv! in a rule even if it is in a process model? Please make it generic and pass the values from RI. Also, make sure to typecast your values to the specific types. Tip - Use tostring() and touniformstring() wisely. 

It would work after the above two steps.