Untitled

mail@pastecode.io avatar
unknown
vbscript
a year ago
2.6 kB
8
Indexable
Never
Const PROP_MASRAF_DETAYI = 1318

Dim PropertyValues : Set PropertyValues = Vault.ObjectPropertyOperations.GetProperties(ObjVer)
Dim classOfObject : classOfObject = PropertyValues.SearchForProperty(100).TypedValue.GetValueAsLookup().Item
Dim oObjectInfo : Set oObjectInfo = Vault.ObjectOperations.GetObjectInfo(Objver, True)
Dim masrafDetayListe, oMasrafDetayFormu, ayirac, masrafDetayItem


If classOfObject = 28 Then
    If PropertyValues.IndexOf(PROP_MASRAF_DETAYI) <> -1 THEN
        masrafDetayListe = PropertyValues.SearchForProperty(PROP_MASRAF_DETAYI).TypedValue.DisplayValue
        ayirac = ";"
        masrafDetayItem = Split(masrafDetayListe, ayirac)
        
        For Each listeItem In masrafDetayItem

        set oSearchCondition = CreateObject("MFilesAPI.SearchCondition")
        set oSearchConditions = CreateObject("MFilesAPI.SearchConditions")

            if listeItem <> "" Then
                oSearchCondition.Expression.DataPropertyValuePropertyDef = 1325
                oSearchCondition.ConditionType = MFConditionTypeEqual
                oSearchCondition.TypedValue.SetValue MfDataTypeText, listeItem
                oSearchConditions.Add -1, oSearchCondition
                        
                oSearchCondition.Expression.DataStatusValueType = MFStatusTypeDeleted 
                oSearchCondition.ConditionType = MFConditionTypeEqual
                oSearchCondition.TypedValue.SetValue MFDatatypeBoolean, false 
                oSearchConditions.Add -1, oSearchCondition

                Dim oSearchResultsP : Set oSearchResultsP = Vault.ObjectSearchOperations.SearchForObjectsByConditions(oSearchConditions,MFSearchFlagNone,False)
                Dim varSonucSayP : varSonucSayP = oSearchResultsP.Count

                
                IF (varSonucSayP <> 0) then
                    set oObjID = CreateObject("MFilesAPI.ObjID")
                    oObjID.Type = 149
                    oObjID.ID = oSearchResultsP.Item(1).ObjVer.ID
                    
                    Dim oValue : SET oValue = CreateObject("MFilesAPI.PropertyValue")
                    Set oValues = CreateObject("MFilesAPI.PropertyValues")  
                
                    oValue.PropertyDef = 1676
                    oValue.TypedValue.SetValue MFDatatypeLookup, 1  ' 1 = EVET,  2 = HAYIR
                    oValues.Add 0 , oValue
                    
                    Vault.ObjectPropertyOperations.SetProperties oSearchResultsP.Item(1).ObjVer, oValues
                End If
            End If
        Next
    End If
End If