Using aaApi_CreateProject for a folder with a wildcard character

Using a custom-created tool that migrates another document management system into ProjectWise.  A call to aaApi_CreateProject will create a folder that contains a "%" character.  But it would seem that if try to then create another folder that is similar enough to the existing one where a search using the "%" as a wildcard would return both of them, aaApi_CreateProject fails with a AAERR_DMS_ERR_PRO_NAME_NOT_UNIQUE (58065) error.

For example, aaApi_CreateProject will successfully create folder "90% Package" but will then fail if you use it to create "90% ABC Package" because a search using "90% Package" would return both.

Changing the second folder name where the wildcard would no longer return both (e.g. "90% ABC Package (1)") works.  However, if the first folder was just "90%", then no appendage is gong to fix it.  You'd have to either replace the wildcard character in the folder name or change the folder name in front of the wildcard character.

I've tried looking in the SDK documentation to see if there is a way to turn off the wildcard character for the session, but have not found anything.  That seems like the ideal solution if I can find it.

Parents
  • Sorry, correction.  In the example, I said that aaApi_CreateProject will successfully create folder "90% Package" but will then fail if you use it to create "90% ABC Package".  That actually works okay.  It's if you do the opposite, create "90% ABC Package" successfully and then try to create "90% Package" that it fails.

  • FWIW, this isn't the only place where ProjectWise can misinterpret what you mean when you include any wildcard characters for names or other text properties.  Another "problem" is the under-bar character, quite commonly used in CAD applications, especially those dating back when spaces were not valid characters in text.  If you have two documents named like this "ABC1EFG" and "ABC_EFG" and search for "ABC_EFG", your search will return both because the under-bar character  is passed to the underlying database and then interpreted as "match any single character".  And there are more "special characters" that will be interpreted in a way you may not expect such as the star character "*".  The list depends upon the database used.

    The percent character means match zero or more characters (any characters) as does the star character.

    ProjectWise will "quote" (use escape characters) to allow you to create names and other text values contain these special characters in the value as you specified.  However, when ProjectWise uses that string to check to see if it is unique (when required), it doesn't escape the special characters so the underlying database which then interprets those characters as wildcards, and the result is what you are observing.

    If you try to quote (use an escape character) so that your search will intercept the wild character as just a character, that works when you do it via the search builder tool, but when you don't control the search, like in your case when you are trying to create another folder with a conflict in uniqueness when the percent character is being interpreted as a wildcard, the search will return all matches, which ProjectWise interprets as meaning that the text string is "not unique'.

    A "catch-22", and no easy way around it.

    You can work around this by either controlling the order that you create potentially conflicting text strings, or make them all unique and then later, rename them the way you want them.  For example, for the case you mention that fails, just make the second name unique and then after creating it, then you can rename it to what you wanted, and that doesn't fail because the rename function is quoting (escaping) the special character.

    No easy fix and trying to educate "end users" on the subtleties of how to format their searches when these special (wildcard) characters are in the text string that they are using for the criteria is pretty much a problem, either because the end user doesn't understand enough about what is going on, or just frustrated that it matters at all.

    I have not verified that this will work (it should), but you could create each folder with a unique prefix such as "XYZ" and then after you create it, rename it without the prefix.  So assuming that "90% ABC Package" already exists, you create "XYZ90% Package", which should succeed, and then rename it to "90% Package", i.e. removing the unique prefix.

    HTHs

    Answer Verified By: Carl.Goetz 

  • Thanks, Dan.  I had discovered the "make unique then rename" work-around, so I'm trying that.

    I'll have to look at the underscore character as being a potential issue as we that as a replacement for characters that are invalid in ProjectWise but are used in the other systems.  I'm guessing the potential is there for problems, but just that we haven't run into that specific combination yet.  I'm surprised the issue at hand took as long as it did.

Reply
  • Thanks, Dan.  I had discovered the "make unique then rename" work-around, so I'm trying that.

    I'll have to look at the underscore character as being a potential issue as we that as a replacement for characters that are invalid in ProjectWise but are used in the other systems.  I'm guessing the potential is there for problems, but just that we haven't run into that specific combination yet.  I'm surprised the issue at hand took as long as it did.

Children
No Data