CloudFabrix Documentation
Asset IntelligenceOps IntelligenceObservabilityRobotic Data
  • Getting Started
  • CloudFabrix Overview
  • AIOps Platform
  • AIOps Solutions
  • CloudFabrix RDA
    • RDA - Overview
      • RDA - Terminology and Artifacts
    • RDA - Installation
      • Linux OS
      • Windows OS
      • Mac OS
      • RDA Client
      • Worker Nodes
      • Event Gateway
      • Edge Collector
      • Log Shippers
        • Filebeat
        • Fluentd
        • Rsyslog
        • Syslog (udp)
        • Splunk forwarder (Windows and Linux)
        • Winlogbeat (Windows)
      • RDA Log Archives
    • RDA - Administration
      • RDA - Configuration
    • RDA - User Guide
      • RDA - AIOps Studio
        • AIOps Studio - Solution Packages
        • AIOps Studio - Pipelines
        • AIOps Studio - Explore
        • AIOps Studio - Administration
        • RDA CLI in UI
        • AIOps Studio - Examples
          • File Operations
          • Loop Operations
          • Data Management Operations - cfxdm
          • Data mapping - cfxdm - dm:eval
          • Filters - cfxdm - dm:filter
          • Data mapping - cfxdm - dm:map
          • Metadata - cfxdm-dm:metadata
          • Data mapping - cfxdm - dm:functions
            • Any_non_null
            • Concat
            • Datetime
            • Date and Timestamp
            • Evaluate
            • Fixed
            • Highest
            • Join
            • jsonDecode
            • Lower
            • Lowest
            • Match
            • Minutes_Between
            • Replace
            • Seconds_Between
            • Slice
            • Split
            • Strip
            • To_Numeric
            • Ts_To_Datetimestr
            • Upper
            • When_Null
          • Data Mapping cfxdm - dm:sort
          • Data Mapping cfxdm - dm:head
          • Data Mapping cfxdm - dm: tail
          • Data Mapping cfxdm - dm: dedup
          • Data Mapping cfxdm - dm:selectcolumns
          • Data Mapping cfxdm - dm:fixcolumns
          • Data Mapping cfxdm - dm:mergecolumns
          • Data Mapping cfxdm - dm:describe
          • Data Mapping cfxdm - dm:save
          • Data Mapping cfxdm - dm:savedlist
          • Data Mapping cfxdm - dm:recall
          • Data Mapping cfxdm - dm:concat
          • Data Mapping cfxdm - dm:groupby
          • Data Mapping cfxdm - dm:to_type
          • Data Mapping cfxdm - dm:enrich
          • Data Mapping cfxdm - dm:dns_ip_to_name
          • Data Mapping cfxdm - dm:dns_name_to_ip
        • AIOps Studio - Datasource Examples
          • Elasticsearch (v1)
      • RDA - Data Management (cfxdm)
        • cfxdm - dm:filter
        • cfxdm - dm:map
        • cfxdm - dm:functions
        • cfxdm - dm:sort
        • cfxdm - dm:head
        • cfxdm - dm:tail
        • cfxdm - dm:dedup
        • cfxdm - dm:selectcolumns
        • cfxdm - dm:mergecolumns
        • cfxdm - dm:describe
        • cfxdm - dm:hist
        • cfxdm - dm:bin
        • cfxdm - dm:fixcolumns
        • cfxdm - dm:save
        • cfxdm - dm:savedlist
        • cfxdx - dm:recall
        • cfxdm - dm:concat
        • cfxdm - dm:groupby
        • cfxdm - dm:enrich
        • cfxdm - dm:to_type
        • cfxdm - dm:dns_ip_to_name
        • cfxdm - dm:dns_name_to_ip
        • cfxdm - files:loadfile
      • RDA Terminal
        • Examples using Terminal / Commandline
    • RDA - Bot Documentation
    • RDA - Datasource Integrations
      • AppDynamics
      • Dynatrace
      • Dell EMC Unity
      • Elasticsearch
      • Infoblox NetMRI
      • Kubernetes Cluster
      • Linux OS
      • Microsoft Windows Server OS
      • Nagios XI
      • NetApp Clustered ONTAP
      • PRTG Network Monitor
      • VMware vCenter
      • VMware vRealize Operations
    • RDA - Python API
      • Class CaaSDataset
      • Class CaaSClient
      • Python API Example
    • RDA - FAQ
      • Download and Installation
      • Troubleshooting
  • CFXQL - CFX Query Language
    • CFXQL User Interface
  • Operations Intelligence Analytics (OIA)
    • Solution Overview
      • Navigating cfxOIA
      • Any title
    • Administration Guide
      • Active Directory Integration
      • Add Customer
      • First Steps
      • OIA Users
      • Add New Users and Assign Roles
      • Add Environment
      • Add Gateway
      • Add DataSource
      • Add Project
      • Project Configuration
      • Stacks
      • Teams
    • User Guide
      • Incidents
        • Incident
        • Stack
      • Alerts
      • Outcomes
  • INTEGRATIONS
    • Zabbix
    • AppDynamics
    • Dynatrace
    • NetApp C Mode
    • NetApp 7 Mode
    • Splunk Enterprise
    • VMware vCenter
  • OBSERVABILITY
  • Observability - IT Infrastructure Monitoring (cfxPulse)
    • Getting Started
    • Solution Overview
    • Installing cfxPulse Collector
    • Administrator Quick Start Guide
      • Prerequisites
      • Accessing cfxPulse
      • Configuration of cfxPulse
      • Setting Up Monitoring
      • Monitoring Using Prometheus Agents
      • How to add Prometheus Agent Details
      • Discovery of Devices
      • Monitoring Dashboard
    • End User Quick Start Guide
      • Portal Navigation
      • Monitoring Analysis
      • Monitoring
      • Alerts and Incidents
      • Reports
      • NOC/Ops
      • Configuration Backups
      • Interacting With Tabular Reports
      • Creating Custom Dashboards
  • Observability - Log Monitoring & Analytics (CFX LogAnalytics or CLA)
    • Getting Started
    • Solution Overview
    • Solution Key Components
    • Log Forwarding
      • Install and Configure Logstash
      • Sending Logs to Logstash Forwarder
    • Log Collection
      • Collecting Logs from Linux
    • Log Transformation & Enrichment
    • Logstash Installation
      • How to install Java / Logstash on client side
  • Asset Intelligence Analytics (AIA) Solution
    • Getting Started
    • Solution Overview
    • AIA Roles
      • Platform Admin
        • Managed Service Provider (MSP)
        • Authentication Server
        • Set Up Services
        • Organizations
        • Users
      • Organization Admin
        • My Organizations
      • Organization Executive
      • Organization User
    • AIA Tasks, Functions
      • Home Page Navigation
      • Filters
      • Settings Menu
      • Notifications
      • Authentical Server
      • How to Add, Edit, Delete MSP
      • Actions
        • Services
        • Files
        • Dictionaries
        • Discovery Jobs
        • Snapshots
        • Clambda Jobs
        • State Operations
        • Replacement Rate
      • Details
        • Overall
        • POR Insights
        • HW Assets
        • SW Assets
        • Contracts
        • App Dependency
        • Asset List
    • AIA API
    • Enterprise Discovery
      • cfxEdgeCollector
        • Deployment of cfxEdgeCollector
        • Configuration of cfxEdgeCollector
        • cfxEdgeCollector Command Line Options
        • cfxEdgeCollector Help Command
        • Working With cfxEdgeCollector
        • cfxEdgeCollector Auto Export
    • Asset Intelligence & Analytics (AIA) (Delete)
  • CloudFabrix SaaS
    • Signup
    • Navigation
    • User Roles
  • Support
    • Contact Support
Powered by GitBook
On this page
  • Replace
  • Example 1:
  • Example 2:
  • Example 3:
  • Example 4:
  1. CloudFabrix RDA
  2. RDA - User Guide
  3. RDA - AIOps Studio
  4. AIOps Studio - Examples
  5. Data mapping - cfxdm - dm:functions

Replace

PreviousMinutes_BetweenNextSeconds_Between

Last updated 3 years ago

Replace

Replaces old value with new value in the input string @param old value, Type string. @param new value, Type string. Input must be a string.

Replace 'oldvalue' with 'newvalue' in the input string @param oldvalue Type string @param newvalue Type string Input must be a string

This function allows users to replace or substitute a new string value in place of an old existing string value. This allows users to modify column values and add additional string values as per need and requirement

Example 1:

Step 1: Create an empty replace_example using AIOps studio as shown in the below screenshot.

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment. ##### This pipeline creates a simple record for an attribute (column) ##### using AIOps studio. ##### RDA function replace is used to demo this example. ##### This function uses 'newvalue' to replace 'oldvalue' both are in ##### string format. ##### Function 'replace' replaces old value with new value @dm:empty --> @dm:addrow id = '1' & category = 'Cluster-1' & value = 10 --> @dm:addrow id = '2' & category = 'Cluster-2' & value = 101 --> @dm:addrow id = '3' & category = 'Cluster-3' & value = 21 --> @dm:addrow id = '4' & category = 'Cluster-4' & value = 30 --> @dm:addrow id = '5' & category = 'Test-Cluster-5' & value = 500 --> @dm:addrow id = '6' & category = 'Cluster-6' & value = 50 --> @dm:map func = 'replace' & oldvalue = 'Cluster' & newvalue = 'CFX-Cluster' & attr = 'category'

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

Step 5: RDA uses the replace function to replace the old value with a new value for the selected column. Click on Verify to check replaced values as shown below.

Simple Example - The following is a simple example of another example and final verify output where attribute 'column1' has a value of "Hello abc World" is replaced with "Hello CFX World" after successful execution of pipeline. Try this on your own (as shown below screenshot).

Example 2:

This example provides a pipeline that uses the 'replace' function to replace a specific character within a string. This will be useful in case if a user wants to search and replace a special character or add additional tokens etc.

Step 1: Create an empty replace_char_example using AIOps studio as shown in the below screenshot.

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment. ##### This pipeline creates a simple record for an attribute (column) ##### using AIOps studio. ##### RDA function replace is used to demo this example. ##### This function uses 'newvalue' to replace 'oldvalue' both are in ##### string format. ##### Function 'replace' replaces char '"' with empty char '' @dm:empty --> @dm:addrow column = 'Hello " World' --> @dm:eval column = "column.replace(chr(34),'')"

Note: Users can use this example to try other characters replacements and/or other character token replacements

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

Step 5: RDA uses the replace function to replace a character from the string with an empty token and prints the output of the original string as shown in the below screenshot.

Old value --> 'Hello " World' New value --> 'Hello World'

Example 3:

This example provides a pipeline that uses the 'replace' function multiple times to search for a pattern that is repeated within a string and replace a common character separator or token within that string.

Step 1: Create an empty replace_multi_char_example using AIOps studio as shown in the below screenshot.

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment. ##### This pipeline creates a simple record for an attribute (mac) ##### using AIOps studio. ##### RDA function replace is used twice to demo this example. ##### This function uses 'newvalue' to replace 'oldvalue' both are in ##### char format. ##### Function 'replace' replaces char '| ' and '|' with ',' character @dm:empty --> @dm:addrow mac = '001b 6384 45e6| 001c 4432 4467 000a 959d 6816|000a 959d 6816' --> @dm:eval mac = "mac.replace('| ',',').replace('|',',')"

Note: Example uses two patterns to replace special character or token with other tokens within the mac addresses

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

Step 5: RDA uses the function 'replace' to replace multi-pattern character tokens, adds 'comma' as token, and returns the string after replacement as shown in the below screenshot.

In addition to the above-provided examples, users can use replace for any substitution of strings, special chars, within the pipeline context and store the data.

Example 4:

This example provides a pipeline that uses the 'replace' function when the column values have ’Cluster” as the name should add a prefix (e.g. Sub or other prefixes ). This will help users to replace or substitute a string value with custom strings or prefixes.

Step 1: Create an empty replace_prefix_example using AIOps studio as shown in the below screenshot.

Step 2: Add the following pipeline code/commands into the above-created pipeline as shown in the below screenshot:

You can copy the below code into your pipeline and execute that in your environment. ##### This pipeline creates set of records that contains Cluster-x as value strings ##### in the dataset. ##### RDA function replace is used to demo this example. ##### This function uses replace (substitute) column values that contain Cluster ##### with a prefix 'Sub' and adds it back ##### Function 'replace' replaces old value (Cluster) with new value (Sub) @dm:empty --> @dm:addrow id = '1' & category = 'Cluster-1' & value = 10 --> @dm:addrow id = '2' & category = 'Cluster-2' & value = 101 --> @dm:addrow id = '3' & category = 'Cluster-3' & value = 21 --> @dm:addrow id = '4' & category = 'Cluster-4' & value = 30 --> @dm:addrow id = '5' & category = 'Test-Cluster-5' & value = 500 --> @dm:addrow id = '6' & category = 'Cluster-6' & value = 50 --> @dm:map func = 'replace' & oldvalue = 'Cluster' & newvalue = 'CFX-Cluster' & attr = 'category'

Step 3: Click verify button to make sure syntax and pipeline code is correct (as shown below)

Step 4: Click execute button and execute the pipeline. RDA will execute the pipeline without any errors (as shown below)

Step 5: RDA uses the function 'replace' to replace/substitute the 'Cluster' string with 'CFX' and returns the string after replacement as shown in the below screenshot.

Empty pipeline 'replace_example' created in RDA
'replace' pipeline code added
RDA verifies the replace pipeline code snippet
RDA executes 'replace pipeline' code snippet without any errors
Replaced Values
Empty 'replace_char_example' pipeline.
RDA verifies validation of pipeline syntax.
Successful execution of above pipeline without any errors.
RDA uses replace function to replace a char in the string and replaces with empty token (space).
RDA verifies the pipeline code snippet for any errors
RDA 'replace' function replaces special pattern strings for replacement/substitution
Empty pipeline
Pipeline code added to empty pipeline window
Verify the pipeline code by selecting 'Verify' button as shown above
Successful execution of pipeline and replacement of the 'Cluster' string with 'CFX' prefix.