Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

How to count frequency of data in dataset

Hi ,

 

Do we have any function in appian which can count frequency of data in dataset.

Test Dataset -

             Column 1 Column 2 Column 3

 Row 1 -     A           B             C

 Row 2-      A           B             D

 Row 3 -     C           B             E

 Row 4-      C           A             F

 Row 5-      C           G             H

 

Here i want to put one validation that combination of row 1 and row 2 should not be same . For that i need one frequency function which can return frequency of data in Column A & Column B. Here we have A & B coming in two rows which should not like that.

 

Kindly help me if anyone knows this.

I need to put one validation rule which should check frequency of

  Discussion posts and replies are publicly visible

Parents
  • For this, You can apply the validation at field level

    like for column 1

    a!gridRowLayout(
    contents:{
    a!textField(
    label:"Column 1",
    value:ri!data[ri!index].c1,
    saveInto:ri!data[ri!index].c1,
    validations:{
    if(
    count(
    whereContains(
    ri!data[ri!index].c1,
    ri!data.c1
    )
    )>1,
    "Data is duplicate",
    {}
    )
    }
    )
    }
    )
  • I applied this approach. But i got to know one knew issue in this approach. As per requirement. I need to match combination of two columns in one dataset . But when i am trying to put this condition its checking count correct but not at horizontal level its checking vertical level. I mean if i have data like

    B 1
    B 2
    C 3
    D 2
    B 3

    In this case its showing error for row 2 (B 2). because count of both is more than one irrespective of any row. But our requirement is to check this combination at row level and it should give use count of that.

    Can you help me in that. I am sharing code snipped which i written on basis of your approach.


    validations: {
    if(or(rule!APN_isBlank(ri!Data[ri!index].sgId),rule!APN_isBlank(ri!Data[ri!index].mtId)),{},if(
    and(
    count(
    whereContains(
    ri!Data[ri!index].sgId,
    local!scData.sgId
    )
    ) > 1,
    count(
    whereContains(
    ri!Data[ri!index].mtId,
    local!scData.mtId
    )
    ) > 1
    ),
    "Duplicate Combination ",
    {}
    ))
    }

Reply
  • I applied this approach. But i got to know one knew issue in this approach. As per requirement. I need to match combination of two columns in one dataset . But when i am trying to put this condition its checking count correct but not at horizontal level its checking vertical level. I mean if i have data like

    B 1
    B 2
    C 3
    D 2
    B 3

    In this case its showing error for row 2 (B 2). because count of both is more than one irrespective of any row. But our requirement is to check this combination at row level and it should give use count of that.

    Can you help me in that. I am sharing code snipped which i written on basis of your approach.


    validations: {
    if(or(rule!APN_isBlank(ri!Data[ri!index].sgId),rule!APN_isBlank(ri!Data[ri!index].mtId)),{},if(
    and(
    count(
    whereContains(
    ri!Data[ri!index].sgId,
    local!scData.sgId
    )
    ) > 1,
    count(
    whereContains(
    ri!Data[ri!index].mtId,
    local!scData.mtId
    )
    ) > 1
    ),
    "Duplicate Combination ",
    {}
    ))
    }

Children