Skip to main content
June 27, 2024
Question

Obtained without duplicate values ​​of record type

  • June 27, 2024
  • 6 replies
  • 0 views

Hi

I want to DISTINCT duplicate data like the attached image.
I know that using recordtype of grouping it can be distinct data.
As my requirement i want to distinct value columns and other columns.

How can I implement it?

6 replies

mikes0011
Brainy
June 27, 2024

More context is needed - are you talking about local data or are you talking about doing aggregation on a query?

If you're talking about de-duplicating local data, like an array, then the standard technique is to take your value that (may have) duplicates, and call union() on it, "unioning" it with itself.  I almost always set up a separate expression rule, i.e. "GLBL_distinct()" that accepts an array and unions it internally, to avoid having to hardcode a union() call into my interface or rule (etc).  This works fairly well for general use cases.

girlc0001Author
June 27, 2024

[mention:b45a4f6a20b14a008e4e0ec732a8bf98:e9ed411860ed4f2ba0265705b8793d05] 

I want to query data and DISTINCT if there are duplicate values ​​in the query values.

mikes0011
Brainy
June 27, 2024

There's no equivalent to "SELECT DISTINCT" from the Appian Query perspective.  Your choices are pretty much limited to 2 ways of handling it - either after querying on the front side, or fix it on the DB side before it ever gets to query.

1) for the first, just query into a local variable then de-duplicate into a separate local variable.  very easy.

2) for the second, you either sanitize your data as it goes into the DB (easy to do ahead of time, much harder to do after the duplicate data is already present); alternatively, you can set up a view that pre-de-duplicates the data, and you run your Appian queries from that view instead.

konduruc733182
June 27, 2024

My question is what makes these rows unique? is it the Country or the code? Do you have data where a country has two codes and you would need those in two different rows?

girlc0001Author
June 27, 2024

 [mention:2df2892a4df7486f9775b4d2f0e405fd:e9ed411860ed4f2ba0265705b8793d05] 

I want to know how to select DISTINCT in appian , so I created some test data  plz don't mind about the data.

davidj137213
Brainy
June 27, 2024

a!queryAggregation(
aggregationColumns: {
a!queryAggregationColumn(
field: "distinctColumn",
isGrouping: true
),