Difference Between Current.Count and Length

As mentioned in the title. Is there any difference between the following two queries?

1. Entity.List.Length

2. Entity.List.Current.Count

Stephen Li wrote:

As mentioned in the title. Is there any difference between the following two queries?

1. Entity.List.Length

2. Entity.List.Current.Count


Hi,

Do you want to ask difference between Entity.List.Length and Entity.Count?

Well, when you have such queries you can assign this values to a variable and check.

Thanks

Solution

Hi Stephen,

Consider a query GetUsers that fetches all records of Users that have their Is_Active attribute set to True.

  • GetUsers.List is the result set of your query. It's Length runtime property will hold the number of records in the list returned.
  • GetUsers.Count is the number of User records that match the filter.

When you access one of these two outputs of a query you will execute a query to the database, if you use the value of both, then two queries will execute: one to get the count, the other to get the requested records.

The answer to your question is "it depends":

  • If your query returns all records that have the Is_Active attribute set to True then there is no difference between the two values.
  • GetUsers.List.Length will have a different value from GetUsers.Count when:
    • The query has a Max. Records value (for instance 30), and there are more records in the database that match the filter (for instance, 231).
    • The query is bound to a Table Records on the Web Screen, there are more records in the database than the Table Records will display per page (Line Count property) and the Table Records is not displaying the last page.
Solution