I have data in CDT where i need to apply some validations to that data

Hi All,

I have data in one cdt where its looks something like this 

id   name     school

1    abc        xyz

2    abc        xyz

3    def        qwe

4    def        qwe

Here i need to apply aggregation on columns, how do i achieve it ?

  Discussion posts and replies are publicly visible

Parents
  • What kind of validations are you trying to add - just the fact that there are duplicate values or do you need to specify directly which ones are the duplicates? you can check duplicates by doing something like length(array) <> length(union(array, array)) in which you're comparing the length of the original against the distinct set of values in your list. 

    Not an efficient way, but you could also do something like:

    a!forEach(
    union(array, array),
    {
    'value': fv!item,
    'count': count(wherecontains(fv!item, array))
    }
    )
Reply
  • What kind of validations are you trying to add - just the fact that there are duplicate values or do you need to specify directly which ones are the duplicates? you can check duplicates by doing something like length(array) <> length(union(array, array)) in which you're comparing the length of the original against the distinct set of values in your list. 

    Not an efficient way, but you could also do something like:

    a!forEach(
    union(array, array),
    {
    'value': fv!item,
    'count': count(wherecontains(fv!item, array))
    }
    )
Children
No Data