Fetch only rows from CDT

Hi Everyone,

Is there a way we can fetch few rows from process variable with type CDT.

I have process variable lets say pv!ABC_cdt, if i want to gets 1st to 10th rows or 20th row to 30th row either i can convert that to todatasubset by adding paging(1,10) or paginf(20,10)  or i have to map the indexes pv!ABC_cdt[{1,2,3,4,5,6,7,8,9,10}]. in my case i cannot use to data subset.. is there any dynamic way where i can get the values by passing "from" and "to" rows.

 

My realtime use case is like below:

I have a data in process variable  i want to display the data in multiple editable grids by dividing the data and i cannot use multiple process variables. even though its multiple grids the data should be stored in single process variable which i'm passing to it.

  Discussion posts and replies are publicly visible

Parents
  • Hi karthik,

    Just write a expression rule and pass your CDT and pass two more variables "from" and "to" like below :


    load(
    local!CDT: {
    {
    ID: "12",
    Name: "ABC"
    },
    {
    ID: "13",
    Name: "ABC"
    },
    {
    ID: "14",
    Name: "ABC"
    },
    ------ n times
    },
    local!data: a!forEach(
    items: local!CDT,
    expression: if(
    and(
    fv!index >= ri!from,
    fv!index <= ri!to
    ),
    fv!item,
    "useLessData"
    )
    ),
    remove(local!data,wherecontains("useLessData",touniformstring(local!data)))
    )

    So now replace local!CDT with your actual array and pass "from" and "to" . Now suppose you sent some wrong index values then we will fill the array with "useLessData" and after that we will remove this as well.

    Regards
    Abhay Giri
Reply
  • Hi karthik,

    Just write a expression rule and pass your CDT and pass two more variables "from" and "to" like below :


    load(
    local!CDT: {
    {
    ID: "12",
    Name: "ABC"
    },
    {
    ID: "13",
    Name: "ABC"
    },
    {
    ID: "14",
    Name: "ABC"
    },
    ------ n times
    },
    local!data: a!forEach(
    items: local!CDT,
    expression: if(
    and(
    fv!index >= ri!from,
    fv!index <= ri!to
    ),
    fv!item,
    "useLessData"
    )
    ),
    remove(local!data,wherecontains("useLessData",touniformstring(local!data)))
    )

    So now replace local!CDT with your actual array and pass "from" and "to" . Now suppose you sent some wrong index values then we will fill the array with "useLessData" and after that we will remove this as well.

    Regards
    Abhay Giri
Children
No Data