Skip to main content
gautams4173
September 26, 2025
Question

DataSubset & Rule Reference Question

  • September 26, 2025
  • 4 replies
  • 0 views

Hi Team,

I had 2 simple questions which I wanted to post here. Please help me if anyone has the answers : 

Context :

You are given a list of CDT / Dictionary / Map with a few fields, eg : 

{ { key: 12, val: "ABC" }, { key: 20, val: "DEF" }, { key: 30, val: "GHI" } }

Problem statement :

Get those CDTs which have key bw 10 & 25 

My approaches :

I had 2 approaches, both of which I have a roadblock

  1. I convert this to list to a data subset using toDataSubset function and then filter on this
  2. I create a rule which takes this `key` as an RI and then returns true / false based on condition. I will use this rule in the filter function and use wherecontains to filter out which matches our condition

Questions : 

Now for the approach 1, I had a question : how do I filter this custom data subset ? because I only see queryEntity and queryRecord but nothing to query this custom dataset 

For approach 2 : is there a way we can eliminate the need of creating a different rule in the env and somehow use some function .. is it possible to create local functions in appian ? something like : 

a!localVariables(
  local!a:  (var){
    
  }
)

4 replies

harshas2775
September 26, 2025

Approach 1 doesnt make much sense according for me. For approach 2 whatever you will do in the expression you can do in the main rule itself by using a foreach(). Can you try something like this? 

a!localVariables(
  local!map: {
    a!map(key: 12, val: "ABC"),
    a!map(key: 20, val: "DEF"),
    a!map(key: 30, val: "GHI")
  },
  a!foreach(
    local!map,
    if(
      and(fv!item.key > 10, fv!item.key < 25),
      fv!item,
      {}
    )
  )
)

gautams4173
September 26, 2025

Why doesn't approach 1 make sense ? Think in terms of DB, if I could have a simple queryFilter return the dataset why not ? 

For the solution you provided in foreach : I didnt want to use this solution, hence was looking for alternatives

Thanks though

harshas2775
September 26, 2025

Given its a dictionary/map then you would need to write it to database so that filtering can be done for approach 1. Personally as per my understanding of the usecase its too much hassle so simpler way is foreach. If you are expecting a large dataset (which is not mentioned in description) then I would go for involving database and approach 1. 

Anyway to answer your questions:

1. 

how do I filter this custom data subset ? because I only see queryEntity and queryRecord but nothing to query this custom dataset 

To filter you need to store data into database using CDT or records. Then you can query the dataset.

2. 

is there a way we can eliminate the need of creating a different rule in the env and somehow use some function .. is it possible to create local functions in appian ? something like

filter() needs a predicate so you need to have a rule/function which can be called here. We cannot create local functions as you are expecting!

shubhama926776
September 26, 2025
Now for the approach 1, I had a question : how do I filter this custom data subset ? because I only see queryEntity and queryRecord but nothing to query this custom dataset 

You cannot filter a custom DataSubset directly; queryEntity/queryRecord work only on database/record entities.

For approach 2 : is there a way we can eliminate the need of creating a different rule in the env and somehow use some function .. is it possible to create local functions in appian ? something like : 

Does not support local or anonymous functions; separate expression rules are required for reusable logic.


Recommend, Use inline filter expressions with conditions or separate rules to filter lists efficiently.