New sorting option for the DataList

Starting with version 5.7.05, the DataList will allow you to define a sort criterion that is independent of the display. I would like to discuss this new feature in more detail in my article. The release of version 5.7.05 is currently scheduled for October 23, 2013.

New Features

The first change concerns the DataList column objects. These have been extended to include the property wpClmTypeSort. This property is used to specify the sort type for the corresponding column. The following types can be selected:
_TypeNone corresponds to sorting the list based on the displayed data. This is the default value.

The types _TypeAlpha, _TypeBool, _TypeByte, _TypeInt, _TypeBigInt, _TypeFloat, _TypeDecimal, _TypeDate, _TypeTime, and _TypeWord are sorted according to the specified data type.
In addition, the commands WinLstCellGet and WinLstCellSet now support a new mode. The _WinLstDatModeSortInfo option can be used to set or retrieve the sort value of a row.

When setting the wpClmTypeSort property for a column, make sure that each row is assigned a corresponding sort value. Otherwise, the sort result is undefined!

If wpClmTypeSort is to be set at runtime, the list must be empty. Columns created dynamically must not yet have been added to a list using WinAdd.

Sorting by multiple columns

By extending the DataList, it is possible to sort across multiple columns.
For example, in a list that includes a column for the date and another column for the time, you can sort the list by the timestamp of the date and time.

First, the column properties must be set. If this is done procedurally, the points described above must be observed. The “Date” column is sorted by timestamp. The “Time” column is not sorted.

// ...
{
  // ...

  // BigInt as the sort type (= timestamp)
  tColumnDate->wpClmTypeSort  # _TypeBigInt;
  tColumnDate->wpClmSortFlags # _WinClmSortFlagsAutoActive
  tColumnDate->wpClmSortImage # _WinClmSortImageKey;

  // Turn off sorting by time
  tColumnTime->wpClmTypeSort  # _TypeNone;
  tColumnTime->wpClmSortFlags # tColumnDate->wpClmSortFlags & ~_WinClmSortFlagsAutoActive;
  tColumnTime->wpClmSortImage # _WinClmSortImageNone;
}

In the next step, you must set the sort value for each row in the Date column. Note that the type of the sort criterion must match that of the wpClmTypeSort property.

// ...
{
  // ...
  // Create a timestamp
  tCaltime->vpDate # 18.10.2013;
  tCaltime->vpTime # 13:11:00;
  tTimeStamp       # CnvBC(tCaltime);  // BigInt-Zeitstempel

  //Set the sort value for the last row
  tDataList->WinLstCellSet(tTimeStamp, sColumnDate, _WinLstDatLineLast, _WinLstDatModeSortInfo);
}

We will provide an example related to this topic in the CodeLibrary.

Klicken Sie hier, um die Nutzungsbedingungen für unseren Blog zu lesen.

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

Requests, questions or feedback are welcome:

Terms of use of the comment function in the blog

1. General information

Vectorsoft AG (‘Provider’) provides a public blog for Internet users (‘Users’) on the vectorsoft.de website. The public blog is intended for the exchange of information and ideas. Users who participate with contributions and comments undertake to comply with the blog terms of use and are responsible for the accuracy, appropriateness and freedom from legal infringements of their contributions. By using the comment function in our blog, you accept these terms of use.

2. Netiquette

We ask you to refrain from personal attacks and provocations based on other opinions. Please argue objectively and maintain a constructive discussion culture. Your comment should always be related to the topic in question in order to avoid digressions into other topics. Posting the same comment or several similar comments more than once is not permitted.

3. Prohibition of illegal content

By submitting your comment, you confirm that you are not violating any copyrights or other rights of third parties. Inciting, racist statements, instructions for criminal offences and their glorification, depictions of violence, pornographic content and statements that violate personal rights are prohibited.

4. No advertising

The use of the comment function is not permitted for commercial or party-political purposes. Advertising contributions of any kind will be deleted immediately.

5. Details of the name

When entering your name, pay attention to the principles mentioned above.

6. Source references

If you intend to publish quotes or contributions from third parties, please indicate the respective sources and explain how they relate to the blog post.

7. Violation of the terms of use

Posts that violate this policy will be deleted immediately. If you notice any violations yourself, please send us the link to the comment in question by e-mail to . We expressly point out that we will exclude individual users in the event of repeated or serious violations of these terms of use.

As of: Sept. 2024

Get your Trial Version now!

Test yeet free of charge

IHRE EVALUIERUNGSLIZENZ - JETZT ANFORDERN!

TESTEN SIE DIE CONZEPT 16 VOLLVERSION - UNVERBINDLICH und KOSTENFREI

Subscribe to our newsletter

Anrede*
     
Zustimmung zur Datenverarbeitung gem. DSGVO*



WordPress Cookie Notice by Real Cookie Banner