Compare two multi-select properties

Hello,

I am new to vbscripts, I would like help with a code example of two multi-selection properties, in one of the properties invoice numbers are stored and in the other the pdf of the invoices that also have their respective numbers by name. I would like to compare those two properties, when they are equal they give me as a result a true value in a property.

Please help.

Thanks,

Parents
  • Hey Johnny, 

    I'm looking to see if we have any samples to provide you. This use case has some interesting caveats I think which I'd like to confirm.  Given the fact that multiple invoices could be in both properties there is no guaranty the order is going to match, so doing a strict text comparison is out.  Likely getting the values for each property and then iterating through each is going to be required.  Since these are drop downs, we're also dealing with Lookups and these will return the IDs for each of the objects.  Setting up search conditions to return the values of each property's individual values as text and then comparing them is going to be required since we're dealing with different lists and we can't simply compare the IDs directly.  Let me see if we have any examples I can share and get back with you later today.

    In the meantime, have you taken a look at our developer portal? 

    https://developer.m-files.com/Built-In/VBScript/ 

    Tom

  • Thank you very much Tom,

    I explain the case a little better,

    I have a parent PDF document that brings several sub-objects with only metadata, then in the process the pdfs of the sub-objects will be added. Then in the parent object I will have two multiple selection lists, the first that shows me all the associated sub-objects that are pure metadata, the second that shows me all the associated pdfs, once these two properties have the same names that the comparison is made with the boolean property telling me if the comparison is true or false.

  • So are we to understand that both properties are selecting sub objects from the same list but with different filters so that one property shows all sub objects from that list and the other property only shows those subobjects that have files attached somehow?

    If that is the case then the second property can never have sub objects that are not also listed in the first property, but it may have fewer sub objects in case not all sub objects have files attached. In this scenario it would be sufficient to just compare the object count from both properties. If the counts are equal your requirement is fulfilled and you can set the third property to True.

    If my understanding is not correct, you will need a much more complicated comparison as Tom has outlined.

  • The first property would be a list of objects that contain only metadata of invoices or dispatch guides, in the second property it would be another object that contains the pdf of the first object.
    The use case would be that a company dispatches several projects in trucks, before leaving the products of that company, metadata of the invoices is generated, and a parent document called route, this document can have several invoices, when the truck returns it brings the invoices signed by the clients, when all the invoices are completed the route remains as completed, the problem is that many times not all the signed invoices return. The client wants to know which routes are completed with all his invoices and which are not.

    Thanks for the help

Reply
  • The first property would be a list of objects that contain only metadata of invoices or dispatch guides, in the second property it would be another object that contains the pdf of the first object.
    The use case would be that a company dispatches several projects in trucks, before leaving the products of that company, metadata of the invoices is generated, and a parent document called route, this document can have several invoices, when the truck returns it brings the invoices signed by the clients, when all the invoices are completed the route remains as completed, the problem is that many times not all the signed invoices return. The client wants to know which routes are completed with all his invoices and which are not.

    Thanks for the help

Children