This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Multiple Line Custom Property

As per the title... is there a way to create a multiple line CP, and if so one that will preferably obey carriage returns or some other means of enforcing text on to a new line.

  • I have found that you can.  It doesn't show in the Web UI, or in SWQL queries.  But if you copy the field value out of SQL/SWQL Studio and paste it into something else like Notepad, the carriage return is there.  It will also display in alerts.

    It looks like it does cause issues with how it's displayed in the Orion Website though.  If you go to "Manage Nodes" and group by the custom property that you added the value with a carriage return to, the node(s) will not display in the nodes list.  I'm not sure why this is.

    carriage_return_nodeManagement.png

    I use tables in my alerts to organize the data, and the field that I inserted the carriage return into displayed that way

    carriage_return_alert.png

    I was able to do this via the API.  In PowerShell I just added the carriage return inside the string:

    Import-Module SwisPowerShell
    
    $swisHostname = "orion.url"
    $swisCredential = Get-Credential
    $swis = Connect-Swis -Hostname $swisHostname -Credential $swisCredential
    
    $caption = "servername"
    
    # Create a SPLAT of the values to pass into the Set-SwisObject
    $customProps = @{
        unmanage_reason="Example `r`n Text"; # the 'backticks' for R and N create the carriage return/new-line.
    }
    
    # Get NodeIDs of nodes to be updated
    $query = "SELECT NodeID FROM Orion.Nodes WHERE Caption = '{0}'" -f $caption
    
    $result = Get-SwisData -SwisConnection $swis -Query $query
    
    foreach ($nodeId in $result) {
        # build the node URI
        $uri = "swis://localhost/Orion/Orion.Nodes/NodeID=$($nodeId)/CustomProperties";
        
        # set the custom property
        Set-SwisObject $swis -Uri $uri -Properties $customProps
    }
  • Hi and thanks for the reply.

    The powershell stuff is beyond me as I am not and have never been a scripter. However, I guess I could have been clearer in my original request.

    I must admit, I haven't tried copying data back out to see what happens so that is good to know. But what we need is to be able to display certain text on a node details page in a multi line format. So that carriage return has to be enforced for readability.

  • I haven't tried it yet, but after yesterdays vSWUG event I believe I can utilise basic HTML coding for line breaks withincustom properties.

    So that is my next avenue of attack. If it works, I'll be back to post up a how I did it.

  • After discussions on the vSWUG I'm going to tag in and  

    Not sure if the above is clear enough for our use situation, but essentially we need a way to store plain text in a clear manner on a per node basis - so this ideally needs to obey carriage returns. It does not need to be searchable or extractable from the DB for any form of query other than to display on the node details page.

    Should that device then need a rebuild / replacement, these details are then easily available / visible to any engineer.

    Does that help clarify?

    So, to restate. Is there a way to generate a multi-line custom property where we decide what equals a new line, and if yes, then how?