Copy and create a custom function like this one:
Then feed it a list of ONLY the number portion on the end.
You can do that with either a loop:
Set Variable [ $i ; $i +1 ]
Set Variable [ $value ; GetValue ( $YourVariable ; $i) ]
Set Variable [ $list ; List ( $list ; right( $value ; Length ($value) - Position($value;".";1;2) ) ) ]
Exit Loop if [ $i = ValueCount($YourVariable) ]
Set Variable [ $result ; MaxNumValue($list) ]
Where $YourVariable is your current variable, and $result is the max value returned.
Or better yet, MODIFY the custom function so it takes your format and returns the top value, no scripting required.
As an alternative to Mike B's suggestion, you could just modify the format you're using for revisions to include leading zeros. Thus:
Then a text sort will automatically get you the latest version. The downside of this method is you have an upper limit, depending on how many leading zeros you insert (in the above example, the largest you can have is 9999). So you may wind up having to do something else anyway.
if script must be, then loop (no custom functions)
Set Variable [$max; Value:0]
Set Variable [$content; Value:maxvalue::listfield]
Set Variable [$values; Value:ValueCount($content)]
Exit Loop If [Let ($i = $i + 1; $i > $values)]
Set Variable [$currentValue; Value:GetAsNumber(RightWords(GetValue($content;$i);1))]
Set Variable [$max; Value:Max($max; $currentValue)]
Set Field [maxvalue::maxvalue; $max]
but I prefer Mike_Mitchell 's approach.
See attachment, too.
maxvalue.fmp12.zip 65.5 K
Thanks for the replies guys.
No can do on Mike_Mitchell 's approach. The CAD software manages the version numbers and I don't want to mess with that.
I already had a script similar to what siplus suggested, but was hoping for something a little more snappy as it adds a bit of time to the script. I have a monster script that downloads CAD files from a server and it evaluates all kinds of things like file type, revision, version, etc...
This will have to do.
If you want something snappier than a loop script, then go with my method of modifying a custom function to suit your needs.
The one I posted already gets the max value, you just need to adapt it to strip off the first part of the string before the number before it evaluates the number.
Thanks for the reply mikebeargie .
I created the custom function when you mentioned it in your original reply. I am planning to modify it to see if that works better for me when I work out some other details.
I really appreciate it.