Community

Connect with us and enhance your M-Files experience using Unitfly Toolkit for M-Files. Here’s how to get started.

Notifications
Clear all

Set Boolean value based on Date (Year) evaluation

0
Topic starter

Hi,

We have some calculated properties in our vault and would like to migrate the code to the extension kit so we can do recalculations on a scheduled basis.

Have been trying to get this code fragment into 'Extended Auto Properties', but so far without success.

How should we configure and would it even be possible?

----

Option Explicit
Dim oPropertyValues : Set oPropertyValues = Vault.ObjectPropertyOperations.GetProperties( ObjVer, True)
Dim iDeleteYear : iDeleteYear = vault.PropertyDefOperations.GetPropertyDefIDByAlias("clbrm.delete-year")
Dim oDeleteYear : oDeleteYear = oPropertyValues.SearchForProperty(iDeleteYear).Value
 
Dim MyOutput : MyOutput = 0
Dim MyYear   : MyYear = Year(now)
 
If Not IsNull(oDeleteYear) then
if Len(oDeleteYear) > 0 then
if oDeleteYear >= MyYear then
MyOutput = 1
End if
end if
end if
 
output = MyOutput
----
 
Any suggestions are welcome :-).
Thanks in advance and best regards, Tom
 
2 Answers
0

Hi Tom, 

The described case can be solved using Extended Auto Properties.

Could you please try using this expression (Ternary operator parser) in the Property value field: <<'%PROPERTY_{PD.Year1}%' >= '<<YEAR>>' ? 'true' : 'false'>>

Configuration example:

image

Regards, 

Nikolina

0
Topic starter

Hi Nikolina,

Silly me, works as a charm 👍 .

Thanks, Tom

Answer

WATCH THE WEBINAR

Introducing AI Document Kit: Add-on for AI-driven Document Management