DataSubset & Rule Reference Question

Certified Senior Developer

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){
    
  }
)

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to GautamShenoy

    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!