Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
ProjectWise
  • Product Communities
ProjectWise
ProjectWise PowerShell Extensions Forum Add-PWSavedSearch syntax for $FIELD$ search
    • Sign In

    • State Suggested Answer
    • Replies 15 replies
    • Answers 1 answer
    • Subscribers 66 subscribers
    • Views 1087 views
    • Users 0 members are here

    Add-PWSavedSearch syntax for $FIELD$ search

    Thomas Bogø Nissen
    Offline Thomas Bogø Nissen 9 months ago

    According to the change log, support for $FIELD expression was added in PWPS_DAB version 2.1.18.0

    using the following powershell code:

    $AuditUser = 'thbn'
    $SearchField = "`$FIELD(10)`$ = (SELECT DISTINCT o_userno FROM dms_user WHERE o_username in ('$AuditUser'))"
    $AuditSkabelon = 'Innovationsprojekter\Test_THBN\'
    $SearchFolder = 'Større anlæg\7x\'
    
    Get-PWRichProjects -FolderPath $AuditSkabelon -JustOne | 
    Add-PWSavedSearch -SearchName 'CAD-files' -Environment 'Dokument' -DocumentName $SearchField -SearchFolder $SearchFolder -SearchSubFolders -UpdatedAfter 10/10-2020 -ReplaceExisting -Verbose

    Gives the following in the search builder:
    ='$FIELD(10)$ = (SELECT DISTINCT o_userno FROM dms_user WHERE o_username in ('thbn'))'
    
    however, this was the expected search result:
    $FIELD(10)$ = (SELECT DISTINCT o_userno FROM dms_user WHERE o_username in ('thbn'))

    Do we have any examples for writing the $FIELD expression ?

    • Sign in to reply
    • Cancel

    Top Replies

    • MWBSI
      MWBSI Tue, Dec 13 2022 4:56 PM +1
      Thank you for bringing this to our attention. Your field syntax is correct. This should work better next release. Mark Weisman | Bentley Systems
    • MWBSI
      MWBSI Tue, Mar 21 2023 8:41 AM in reply to craig.tobias +1
      The PWPS module will only work in 32-bit mode. PWPS_DAB works in 32 bit mode and 64 bit mode. If you use both, mix cmdlets carefully. For instance you do no want to login in with a cmdlet from the PWPS_DAB…
    • MWBSI
      0 MWBSI Tue, Dec 13 2022 4:56 PM

      Thank you for bringing this to our attention.  Your field syntax is correct.  This should work better next release.

      Mark Weisman | Bentley Systems

      • Cancel
      • Vote Up +1 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Thomas Bogø Nissen
      0 Offline Thomas Bogø Nissen Wed, Dec 14 2022 2:06 PM in reply to MWBSI

      Thanks for the quick response - the code above is now working.
      However, i am facing issues with FIELD-searches like:

      #Search Filtyper
      $FiltyperArguments = @{
        SearchName = 'Filtyper'
        Description = $userFIELD
        FileName = "`$FIELD`$  LIKE '%.zip' OR `$FIELD`$ LIKE '%.7z' OR `$FIELD`$  LIKE '%.rar'" 
        SearchFolder = 'Større anlæg\7x\'
        UpdatedAfter = $AuditDate.AddMonths(-3)
        SearchSubFolders = $true
        ReplaceExisting = $true
      }
      $AuditProjekt | Add-PWSavedSearch @FiltyperArguments -Verbose
      
      Gives the following search value:
      LIKE '$FIELD$  LIKE '%.zip' OR $FIELD$ LIKE '%.7z' OR $FIELD$  LIKE '%.rar''
      
      And not the expected:
      $FIELD$  LIKE '%.zip' OR $FIELD$ LIKE '%.7z' OR $FIELD$  LIKE '%.rar'

      I dont know if it is related, but i in pwps_dab version 2.1.22.0 i am also getting error running the cmdlet Add-PWSavedFolderSearch. Stating that it can not find 'CreateFolderSearch' in 'PWSearchWrapperX64.dll'

      is FIELD-searches also supported in the cmdlet Add-PWSavedFolderSearch ?

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • MWBSI
      0 MWBSI Wed, Dec 14 2022 2:56 PM in reply to Thomas Bogø Nissen

      Reviewing the change log, it states that we added support for $field$ expression to Add-PWSavedSearch.  We will extend that support to other cmdlets as time allows.  We will also look into the trailing single quote issue.   Fixing Add-PWSavedFolderSearch will be our highest priority.

      Thanks,

      Mark Weisman | Bentley Systems

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • MWBSI
      0 MWBSI Thu, Dec 22 2022 9:43 PM in reply to MWBSI

      Add-PWFolderSavedSearch should now be working in the new 2.1.23.0 release.  It does not as of yet support $field$ expressions.

      Mark Weisman | Bentley Systems

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    • Thomas Bogø Nissen
      0 Offline Thomas Bogø Nissen Tue, Jan 10 2023 4:22 PM in reply to MWBSI

      Hi

      related to Add-PWFolderSavedSearch

      i am getting the same date when using the parameters -UpdatedAfter and -UpdatedBefore in the same search.

      i am getting "unknown criterion" when using the parameters -ProjectProperties and -ProjectType 

      • Cancel
      • Vote Up 0 Vote Down
      • Sign in to reply
      • Verify Answer
      • Cancel
    >

    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies