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

Read/Write multiselect property

Former Member
Former Member
Guys, I again need your help. I'm going crazy with a (i think simple) problem, maybe you can help me out?
I've got a "onboarding" document, containing a multi-select property called "Department". It's a simple "choose from list Departments (multiselect).
At the And of the Onboarding, I create a Employee Object in the workflow and "copy" some of the onboarding property values. That works fine! I can copy text and single select (lookup).

What drives me crazy is to read a multiselect and write the same values to the "same" property in the new employee object.

I tried alot... at the moment i try it this way:

Read Multi-Select property

...
' Abteilung/Department
Dim ilookups_abteilung : set ilookups_abteilung = PropertyValues.SearchForProperty(1234).TypedValue.GetValueAsLookups
...


Write to the new object

...
' Abteilung
oPropVal.PropertyDef = 1234
oPropVal.TypedValue.SetValue MFDatatypeMultiSelectLookup, ilookups_abteilung
oPropValues.Add -1, oPropVal
...


That gives me a "type conflict"
What's the problem?
Regards
Chris
Parents
  • Hi,

    The "why" is because you're passing the Lookups object to the SetType method. See the notes on this page:
    www.m-files.com/.../index.html

    Specifically this:

    If the data type of a typed value is MFDataTypeMultiSelectLookup, the caller can supply lookups in one of the following two ways:
    1. By passinga single integer. A single primitive integer is interpreted to be the ID part of a lookup. In this case, the multi-select lookup consists of only one lookup.
    2. By passing a two-dimensional array containing the IDs and display values of lookups. The IDs must be located in the first column and the display values in the second one.


    If you have a Lookups object then the easiest option is to use SetValueToMultiSelectLookup instead:
    www.m-files.com/.../index.html

    Does that help?

    Regards,

    Craig.
Reply
  • Hi,

    The "why" is because you're passing the Lookups object to the SetType method. See the notes on this page:
    www.m-files.com/.../index.html

    Specifically this:

    If the data type of a typed value is MFDataTypeMultiSelectLookup, the caller can supply lookups in one of the following two ways:
    1. By passinga single integer. A single primitive integer is interpreted to be the ID part of a lookup. In this case, the multi-select lookup consists of only one lookup.
    2. By passing a two-dimensional array containing the IDs and display values of lookups. The IDs must be located in the first column and the display values in the second one.


    If you have a Lookups object then the easiest option is to use SetValueToMultiSelectLookup instead:
    www.m-files.com/.../index.html

    Does that help?

    Regards,

    Craig.
Children
No Data