This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

VBScript: Populate a MultiSelect Property (Text List) from another Multi Select Property (Object List)

I read a lot of threads with similar problems but I think no one asked about this case?

The script should run as a Auto Calculated Value on the Multi Select Property which is based on a Text List.. Can you get me started?

Parents
  • Could you please clarify a bit? I do not understand what you mean by a "Multiselect Property (Text list)"?

    You can have a multiline text property allowing you to add more than one line of text. Is that what you mean?
    If yes, then it seems like the goal is to get the displayvalues from all of the lookup items in your multiselect property, right?

    It should be fairly simple to get the propertyvalue from the multiselect property as lookups and then loop through each of those lookups to get the DisplayValue from each of them while adding that text string to a variable. When the loop is completed you have all the text strings gathered in your variable, and you can use that as output. You can probable add a new line character as well after each added displayvalue to make the result look good.

  • With multiselect property (text list) I mean a multi select property which is based of a non object value list. A multi line text property doesn't do the job cause I want to be able to add a single item from the list to a word or excel document which doesn't work out of the box for a document lookup. So in short I want to mirror a multi select property containing documents to a multi select property containing text values.

    This should act as a workaround for my problem described in the following thread (second problem, last post..):

    https://community.m-files.com/forums-1552881334/f/m-files-clients/6208/office-add-in-get-properties-from-related-document

    I can loop through the multi select lookup and collect the elements but I cannot put them in the second lookup cause it is a different data type..

    This is the code I thought I could use for it but I think the problem is that one lookup is object based and the other based on a text value list and so I need to do some conversion to make it work, that's my problem..

    Dim oLookup : Set oLookup = CreateObject("MFilesAPI.Lookup")
    Dim oLookups : Set oLookups = CreateObject("MFilesAPI.Lookups")
    Dim oAdd
    
    Dim oLookups1: Set oLookups1 = PropertyValues.SearchForPropertyByAlias(Vault, "PD.ZugehoerigeObjekte", True).TypedValue.GetValueAsLookups
    For Each oLookup In oLookups1
    	oAdd = 1
    	For Each oLookup1 in oLookups
    		If oLookup1.DisplayValue = oLookup.DisplayValue Then
    		oAdd = 0
    		Exit For
    		End If
    	Next
    	If oAdd = 1 Then
    	oLookups.Add -1, oLookup
    	End If
    Next
    
    Output = oLookups

Reply Children
No Data