How does a!QueryEntity works? I am fetching data from a table through a!que

How does a!QueryEntity works?
I am fetching data from a table through a!queryEntity. Table has n number of columns from which only one can have unique data (Primary Key Column). Others can have duplicate data.
I tried to fetch data in batchSize of 5. The problem is, for a column "Name", if a name is same in 12 rows, and I try to fetch data sorted by "Name" for startIndex 1. The identifiers (primary key) comes: 14; 18; 17; 16; 15. Then I change the startIndex to 6, the identifier comes: 19; 18; 17; 16; 15. Now I change the startIndex to 11, the identifier comes: 16; 15; 4; 7; 6.
If you observe, there is some same data coming in every Set (18,17,16,15 -- > 18,17,16,15 --> 16,15). After that identifier changes because same name is there in table for 12 times only.

Can anyone explain why is this happening ?
Why the same/duplicate data is coming even when data is sorted on that column and startIndex is changing?
I am using a Oracle DB. I ha...

Query

OriginalPostID-184999

OriginalPostID-184999

  Discussion posts and replies are publicly visible

Parents
  • 1. About Duplicate data in results: In queryEntity, sorting the data does not mean that it will avoid duplication. You have specified "NAME" as sortField in a!sortInfo, but that does not mean that it will avoid duplication. You may need to use aggregation with grouping on "NAME" column if you want unique results.

    2. About BatchSize and StartIndex: BatchSize specifies how many rows from the startIndex need to be returned. So if Batchsize is 5 and startIndex is 10, then it will return records from 10 to 15. BatchSize and StartIndex together control which rows need to be returned. If you have ever worked with SQl queries, you will be aware of the LIMIT clause which can control the number of rows to return. batchSize and startIndex serve a similar purpose
Reply
  • 1. About Duplicate data in results: In queryEntity, sorting the data does not mean that it will avoid duplication. You have specified "NAME" as sortField in a!sortInfo, but that does not mean that it will avoid duplication. You may need to use aggregation with grouping on "NAME" column if you want unique results.

    2. About BatchSize and StartIndex: BatchSize specifies how many rows from the startIndex need to be returned. So if Batchsize is 5 and startIndex is 10, then it will return records from 10 to 15. BatchSize and StartIndex together control which rows need to be returned. If you have ever worked with SQl queries, you will be aware of the LIMIT clause which can control the number of rows to return. batchSize and startIndex serve a similar purpose
Children
No Data