Extract text from the right of a string
Answered
Hello,
I am trying to find out on how to extract text/number from the right of a string. For example: RIGHT("3345-1200",4) returns "1200". Any assistances or help would be much appreciated!
Thanks,
Priscilla
Hi Priscilla,
There is not currently a built-in function for this, but using a FreehandSQL Calculated field would allow you to use RIGHT(ColumnName,4). The other option is to add the following custom Advanced Function to your custom-functions.xml file. This will allow you to select the column to split from and input the number of characters to split.
<!-- month function SQL Server-->
<function>
<name>Right, SQL Server</name>
<argument>
<index>1</index>
<name>Input String</name>
<datatype>text</datatype> <!-- numeric, text, datetime -->
</argument>
<argument>
<index>2</index>
<name>Length</name>
<datatype>numeric</datatype>
</argument>
<sql>
<![CDATA[
RIGHT($1,$2)
]]>
</sql>
<database>SQLServer</database>
<database>HSQL</database>
<return>text</return>
</function>
If this does not work for you or I am missing something that could better help you, please let me know.
Cheers,
Neal
Hi Priscilla,
There is not currently a built-in function for this, but using a FreehandSQL Calculated field would allow you to use RIGHT(ColumnName,4). The other option is to add the following custom Advanced Function to your custom-functions.xml file. This will allow you to select the column to split from and input the number of characters to split.
<!-- month function SQL Server-->
<function>
<name>Right, SQL Server</name>
<argument>
<index>1</index>
<name>Input String</name>
<datatype>text</datatype> <!-- numeric, text, datetime -->
</argument>
<argument>
<index>2</index>
<name>Length</name>
<datatype>numeric</datatype>
</argument>
<sql>
<![CDATA[
RIGHT($1,$2)
]]>
</sql>
<database>SQLServer</database>
<database>HSQL</database>
<return>text</return>
</function>
If this does not work for you or I am missing something that could better help you, please let me know.
Cheers,
Neal
Replies have been locked on this page!