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

Write multi select property from value list - part 2

Hi, following on from this post, https://community.m-files.com/forums-1552881334/f/m-files-api/5921/write-mutli-select-property-from-value-list

In that thread I managed to work out how to build a list of all the Workflow States that a document has passed through, and ignore duplicates. It will successfully populate a 'Choose from list "Workflow States" (multi select)' property, H.Property.DocumentStates, so that thread is now Answered

The follow on question is about filtering in the Search. I want to let users Filter their Search results by this DocumentStates property, but unfortunately it shows *every* Workflow State from every Workflow. I want it to just work on the Document's Workflow's States. I can't apply a Filter to the H.Property.DocumentStates so it only filters by the relevant Workflow, and I'm not sure why

If I create a new Value List & Property, H.Property.DocumentStates2, I thought I could pre-populate that value list with matching names for the doc States, and then write my list there, possibly by matching with DisplayValue? but I'm getting Type Mismatches and I think I'm attempting this the wrong way

Essentially my question: is can I read the current Workflow State (from the Workflow State property, which is draws from the Workflow State Value List) and then add those values to my new Document State property, which draws from a Document State Value List?

 

Many thanks

Parents
  • Hello Spooky,

    I'm not sure I understand your problem well, but it maybe would be help for you if you set the DocumentStates2's value at the state of workflow directly.

    You could set the DocumentState2's value to similar as a particular workflow state value.

    We use this method at our vaults.

    Or do you want to use script by all means?

  • Ok, it's now working fully!

    Partly due to your suggestion, even though it was on a different track it gave me an idea, so thank you 

    What it's doing, I'm now not using the Workflow States value list at all

    Instead, I can 'Set' a property as you suggested, which is singular 'Document State' from my curated value list (not the full value list of all workflow states), and then use my script in the previous forum thread which builds a list of those as a multiple 'Document States' list

Reply
  • Ok, it's now working fully!

    Partly due to your suggestion, even though it was on a different track it gave me an idea, so thank you 

    What it's doing, I'm now not using the Workflow States value list at all

    Instead, I can 'Set' a property as you suggested, which is singular 'Document State' from my curated value list (not the full value list of all workflow states), and then use my script in the previous forum thread which builds a list of those as a multiple 'Document States' list

Children
No Data