{"title":"String Manipulation (Multi Column)","nodeType":"Manipulator","id":"*XHEmLNBRrffGaxF4","factoryName":"org.knime.base.node.preproc.stringmanipulation.multicolumn.MultiColumnStringManipulationNodeFactory","factoryId":"org.knime.base.node.preproc.stringmanipulation.multicolumn.MultiColumnStringManipulationNodeFactory","path":["Manipulation","Column","Convert & Replace"],"owner":"knime","ownerAccountId":"account:team:b5f0848f-496d-4e6a-b869-fa3532248db7","description":"<p>The String Manipulation (Multi Column) node is an extension of the String Manipulation node, applying the provided expression to every selected column in turn. This can be used to search and replace, compare, or concatenate strings in multiple columns at once.</p>\n                  \n            <p>In each iteration, one column name from the selection will be used as replacement for the <tt>$$CURRENTCOLUMN$$</tt> placeholder in the expression. For instance, when selecting columns <tt>first_name</tt> and <tt>last_name</tt> , the expression <tt>capitalize($$CURRENTCOLUMN$$)</tt> would first evaluate <tt>capitalize($first_name$)</tt> and then <tt>capitalize($last_name$)</tt> .</p>\n                  \n            <h3>Simple Examples</h3>\n                  \n            <h4>Search and Replace</h4>\n                  \n            <p><tt>replace($$CURRENTCOLUMN$$, &#34;Old&#34;, &#34;New&#34;)</tt> searches for &#34;Old&#34; and replaces with &#34;New&#34; in all selected columns.</p>\n                  \n            <h4>Concatenate Strings</h4>\n                  \n            <p><tt>join($$CURRENTCOLUMN$$, $Unit$)</tt> appends the string in the <tt>Unit</tt> column to each string in the selected columns. When selecting the <tt>Freeze</tt> and <tt>Boil</tt> columns and appending the results as new columns, the following table could result:</p>\n                  \n            FreezeBoilUnitFreeze with UnitBoil with Unit0100˚C0˚C100˚C32212F32F212F273.15373.15K273.15K373.15K\n                  \n            <h3>Advanced Examples</h3>\n                  \n            <h4>Use Columns or Flow Variables to Control String Manipulation</h4>\n                  \n            <p>You can use the value of an integer column to control integer parameters of a string manipulator: <tt>substr($$CURRENTCOLUMN$$, $Start Position$)</tt> extracts the substring of <tt>$$CURRENTCOLUMN$$</tt> that starts at offset <i>k</i> , where <i>k</i> is the integer value in the column <tt>Start Position</tt> in the current row. For example, when the selected column is <tt>Customer</tt> and the results are appended as <tt>Customer Name Only</tt> , the expression <tt>substr($$CURRENTCOLUMN$$, $Start Position$)</tt> could be used to generate the following ouput:</p>\n                  \n            CustomerStart PositionCustomer Name OnlyMr. Jones3JonesProf. Desmond5Desmond\n                  \n            <p>Flow variables can also be used to control the parameter of a string manipulation function. For instance, if there is an integer flow variable <tt>start-position</tt> available, the above example could be rewritten as <tt>substr($$CURRENTCOLUMN$$, $${Istart-position}$$). </tt></p>\n                  \n            <h4>Convert Strings to Missing Values</h4>\n                  \n            <p><tt>toNull(replace($$CURRENTCOLUMN$$, &#34;N.A.&#34;, &#34;&#34;))</tt> searches for &#34;N.A.&#34; in all selected columns, replaces them with &#34;&#34; and returns a missing value, if the resulting string is empty ( <tt>toNull</tt> converts empty strings to a missing value). For multiple strings to replace, a regular expression separating the target strings with <tt>|</tt> can be used: <tt>regexReplace($$CURRENTCOLUMN$$, &#34;N.A.|-&#34;, &#34;&#34;)</tt> . This replaces both occurrences of &#34;N.A.&#34; and &#34;-&#34; with empty strings.</p>\n                  \n        \n        ","shortDescription":"Apply string transformations to several columns at once. The results can either replace the values in the respective source columns or be appended into a new columns.","keywords":["Capitalize","Concatenate","Strip","Multi-field formula"],"deprecated":false,"streamable":true,"tags":["Manipulation","Column","Convert & Replace","Streamable"],"icon":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH5AQBDDQ4lg+AnAAAAJlJREFUOMulk1EOwyAMQ58Rd6jUHrbc3PsZE8oCdBpSROIQsKMgwAzLtgAkPcJLT/YDsWiHyzb/rJqBI83IIObq7OaMetaL0oNusaC19sm11pzd+N5MtzHe+eWXhmWyCsB5XGT0Ae77ZivhPK6phJ20rYQZs+UcZBK6//VANomSPJuDeKbuqK8mEaCMQCxa/UzbkuS6atQT/AUxb7dnibRCfwAAAABJRU5ErkJggg==","views":[],"inPorts":[{"objectClass":"org.knime.core.node.BufferedDataTable","color":"000000","dataType":"Table","optional":false,"name":"Input data","description":"Input data with multiple columns to proces."}],"outPorts":[{"objectClass":"org.knime.core.node.BufferedDataTable","color":"000000","dataType":"Table","optional":false,"name":"Output data","description":"Input data with replaced or appended columns."}],"dynInPorts":[],"dynOutPorts":[],"additionalSiteInformation":{"url":"https://update.knime.com/analytics-platform/5.12","trusted":true,"enabledByDefault":true,"name":"KNIME Analytics Platform 5.12 Update Site","version":"5.12.0"},"dialog":[{"sectionName":"String Manipulation","fields":[{"name":"Column Filter","description":"The columns that the node should loop over. These columns can be <i>dynamically</i> referenced in the expression using <tt>$$CURRENTCOLUMN$$</tt> . Dynamically referenced means that <tt>$$CURRENTCOLUMN$$</tt> refers to different columns, depending on the columns that are selected in the column filter. It is allowed to include non-string columns from the column filter, but their values will be converted to string before substituting them for <tt>$$CURRENTCOLUMN$$</tt> .","optional":false},{"name":"Column List","description":"Available columns in the input data table. They can be <i>statically</i> referenced in an expression, meaning that they always refer to the same column in the input table, no matter which columns are selected to loop over. For instance, the column <tt>age</tt> can be referenced as <tt>$age$</tt> . Values will <b>not</b> automatically be converted to string. If necessary, convert to string, e.g., <tt>string($age$)</tt> .","optional":false},{"name":"Flow Variable List","description":"Available flow variables, which can be used as variables in the expression. Like statically referenced columns, their values are <b>not</b> automatically converted to string. This makes it easier to use them to control non-string parameters of string manipulation functions, like in the substring example above.","optional":false},{"name":"Category","description":"The string function categories.","optional":false},{"name":"Function","description":"List of string functions in the selected category.","optional":false},{"name":"Description","description":"Description and example for the selected function.","optional":false},{"name":"Expression","description":"The expression editor.","optional":false},{"name":"Append Selected Columns with Suffix","description":"If selected, the computed values columns will be appended as new columns, using the original column name with the specified suffix.","optional":false},{"name":"Replace Selected Columns","description":"If selected, the computed values will replace the values in the columns that were selected to loop over.","optional":false},{"name":"Insert missing values as null","description":"When any of the referenced columns (statically or dynamically, see above) contain missing values, the expression can either be evaluated with the missing values set to <tt>null</tt> or be skipped entirely, simply returning a missing value for the output.","optional":false},{"name":"Fail if expression can not be evaluated","description":"Whether to stop node execution when an expression can not be evaluated. This could be the case if an input column contains values that the expression can not handle (e.g., <tt>toInt()</tt> on a column that contains &#34;1&#34;, &#34;2&#34;, &#34;zebra&#34;, &#34;4&#34;, &#34;5&#34; would fail on the third row). The default behavior is to stop execution, but disabling this option will output missing values instead.","optional":false}]}],"links":[],"kudos":[{"accountId":"account:user:3784265b-0f76-45f2-9a61-e472e4206f70","user":"nimantha","date":"2021-02-07T17:46:27+00:00"},{"accountId":"account:user:751e2226-1074-4bf6-b7af-29a0c091d977","user":"gimbo","date":"2021-02-22T14:38:31+00:00"},{"accountId":"account:user:552210dd-3dfc-4b47-bbe6-477d972e6b9e","user":"nilotpalc","date":"2022-05-12T08:11:33+00:00"}],"kudosCount":3,"bundleInformation":{"bundleVersion":"5.12.0.v202606171353","bundleName":"KNIME Java Snippet Nodes","bundleSymbolicName":"org.knime.jsnippets","bundleVendor":"KNIME AG, Zurich, Switzerland","featureSymbolicName":"org.knime.features.javasnippet","featureName":"KNIME Javasnippet","featureVersion":"5.12.0.v202606171353","featureVendor":"KNIME AG, Zurich, Switzerland","extensionId":"*hXfYFyb7ZzM0xseG"},"frequentSuccessors":[]}
