Issue with union

Hi ,

 

I have added working code and non working code.

I am trying to sort by paging info which i added in non-working code which i need to fix. I am sharing working code also where i am not doing any sorting on year which need to be required.

------------------Non Working Code after adding below code 
**local!subMAS_dataset: todatasubset(local!subDataset, a!pagingInfo(startIndex: 1,batchSize: - 1,sort:{{field: "year",ascending: false**
 
---Code Start---  
local!subDataset: rule!MAS_dataset(
    local!id,    
    "details"
  ).data,
 
  local!subMAS_dataset: todatasubset(
    {
      local!subDataset,
      a!pagingInfo(
        startIndex: 1,
        batchSize: - 1,
        sort: {
          {
            field: "year",
            ascending: false
          }
        }
      )
    }
  ),
  
  local!years: reject(
    fn!isNull,
    union(
      local!subMAS_dataset.year,
      local!subMAS_dataset.year
    )
  ),
  
  ----ERROR-----
  Could not display interface. Please check definition and inputs.
Interface Definition: Expression evaluation error at function 'union' parameter 2 [line 100]: Invalid index: Cannot index property 'year' of type Text into type DataSubset
  ----Code End-----
  
  
  ------Working code without sorting year------
  ----Code Start-----
  local!subDataset: rule!MAS_dataset(
    local!id,    
    "details"
  ).data, 
  
  local!years: reject(
    fn!isNull,
    union(
      local!subDataset.year,
      local!subDataset.year
    )
  ),
  
  "NO ERROR"
  ----Code End-----

 

May i know the reason and how to fix that . Please help me on that.

ERROR- Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function 'union' parameter 2 [line 100]: Invalid index: Cannot index property 'cycleYear' of type Text into type DataSubset

  Discussion posts and replies are publicly visible

Parents Reply
  • load(
    local!subDataset:{{name:"a",year:"1962"},{name:"b",year:"1963"},{name:"c",year:"1964"},{name:"d",year:"1965"}},
    local!subMAS_dataset: todatasubset(

    arrayToPage:local!subDataset,
    pagingConfiguration:a!pagingInfo(
    startIndex: 1,
    batchSize: - 1,
    sort: a!sortInfo(

    field: "year",
    ascending: false

    )
    )

    ),
    local!years: reject(
    fn!isNull,
    union(
    index(local!subMAS_dataset.data,"year"),
    index(local!subMAS_dataset.data,"year")
    )
    ),
    local!years


    )

    Try this code,
    the output for this :
    1965; 1964; 1963; 1962
Children