Computing not null values in a CDT

Hi,

I have a CDT which has around 50 attributes, I am required to find the count of not null attributes in my CDT. Is there a way I can do this by not creating a counter which would get updated after 70 if-else checks?

For Example:

Employee_cdt{fName:"Abc",lName:"Def",mName:"",empId:1234,empDept:""...}

A rule to return the not null attributes for Employee_cdt.

 

Thanks,

Arjun

  Discussion posts and replies are publicly visible

Top Replies

Parents
  • Hi Arjun,

    I understood your question. The result should me mName and empDept correct?
    You have to do take all columns/attributes name as array and perform below small line of code

    load(
    local!CDT: {fName:"Abc",lName:"Def",mName:"",empId:1234,empDept:""},
    a!forEach(
    items: {"fName", "lName", "mName", "empId", "empDept"},
    expression: if(
    rule!APN_isBlank(index(local!CDT, fv!item, null)),
    fv!item,
    {}
    )
    )
    )

    this will give desired out put.

    List of Text String: 2 items
    "mName"
    "empDept"
Reply
  • Hi Arjun,

    I understood your question. The result should me mName and empDept correct?
    You have to do take all columns/attributes name as array and perform below small line of code

    load(
    local!CDT: {fName:"Abc",lName:"Def",mName:"",empId:1234,empDept:""},
    a!forEach(
    items: {"fName", "lName", "mName", "empId", "empDept"},
    expression: if(
    rule!APN_isBlank(index(local!CDT, fv!item, null)),
    fv!item,
    {}
    )
    )
    )

    this will give desired out put.

    List of Text String: 2 items
    "mName"
    "empDept"
Children