1 Reply Latest reply on Dec 28, 2018 8:14 AM by Brice-Emmanuel Loiseaux

    query to get distinct value in related records

    James A

      hi

       

      I am trying to pull the related host of storage using the below query but in the "RelatedHostName" it returns many nodes with the same name since the same host connects to many volumes. Is it possible to get only the unique records in the RelatedHostName?

       

      search StorageSystem where type = 'XX' and name has subword 'XX' show name, type, vendor, model, serial,  #Container:Containment:ContainedVolume:StorageVolume.#Provider:StorageUse:Consumer:FileSystem.#MountedFileSystem:FileSystemMount:Mounter:Host.name as 'RelatedHostName'

       

      Regards,

      James

        • 1. Re: query to get distinct value in related records
          Brice-Emmanuel Loiseaux

          I would have expected this unique function could help but the test I ran is not successful:

           

          search StorageSystem where type = 'XX' and name has subword 'XX' show name, type, vendor, model, serial,  unique(#Container:Containment:ContainedVolume:StorageVolume.#Provider:StorageUse:Consumer:FileSystem.#MountedFileSystem:FileSystemMount:Mounter:Host.name) as 'RelatedHostName'

           

          An alternative is to explode on RelatedHostName and use the post processing unique function:

           

          search StorageSystem where type = 'XX' and name has subword 'XX' show name, type, vendor, model, serial,  explode #Container:Containment:ContainedVolume:StorageVolume.#Provider:StorageUse:Consumer:FileSystem.#MountedFileSystem:FileSystemMount:Mounter:Host.name) as 'RelatedHostName' process with unique(1)

          1 of 1 people found this helpful