Start a new topic

Using the path language to get the latest version of an item

To get the latest version of an item in SystemWeaver using a path query, you can do one of the following, depending on the SW client version that you are using.

1. Using any SW client version

Path query:

AllVersions[VersionNumber.ToInteger = AllVersions.Select(VersionNumber).Max]

Item

Description

AllVersions

Returns all versions of an item.

[]

Condition

VersionNumber

Returns the version number of an item

ToInteger

Transforms and type-casts an integer value string into an integer value.

Max

Returns the maximum value in a set of integer values.



2. Using SW client version 1.48.0.20656 (Release Date: 2017-11-16) or later

Path query:

AllVersions.MaxByDate(CreationDate)

Item

Description

AllVersions

Returns all versions of an item.

MaxByDate

A new SW method that returns the object from the list with the latest date property.

CreationDate

Returns the creation date for applicable SystemWeaver objects.


Best Regards
Bashar
1 Comment

One limitation of the first option is using Branch in versioning, which will result in including characters in the version number, for instance, Version=2a1.

The image below shows an example.

image

Best Regards
Bashar

Login to post a comment