Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Using Left() or Substring() IN-DB Formula

grandepaci
6 - Meteoroid

Hi everyone,

 

i want to get the first 50 letters of my "TEXT" column to avoid long text.

 

Here i want to use an IN-DB Formula Tool.

 

I tried left("TEXT",50)  aswell as Substring("TEXT",0,50). Both of those ideas gave an error.

The formula does work with a normal formula Tool, but i have to find a solution with the IN-DB version for future plans.

 

Does anyone have another idea?

We are working with Oracle Databases.

 

Sincerely

 

Gabriel

8 REPLIES 8
IraWatt
17 - Castor
17 - Castor

Hey @grandepaci,

In SQL Substring is indexed from 1 so maybe try Substring("TEXT",1,50) or Substring('TEXT',0,50). What does the error say?

SQL SUBSTRING: Extract a Substring from a String (sqltutorial.org)

DataNath
17 - Castor

Don't you need to write it out in SQL form, rather than the standard syntax we use in workflows? I.e. front it with SELECT and define the table:

 

SELECT LEFT (column, 50) FROM table

 

grandepaci
6 - Meteoroid

@irawatt

i tried that aswell and it was the same error.

Error: Formula In-DB (35): DataWrapOCI: Unable to prepare the query: "WITH "Tool22_c105" AS (SELECT...

 

this is the same error i get when typing in wrong querys

 

 

@DataNath

i understand the idea behind referencing it directly from the table. Unfortunately, i got the same error

DataNath
17 - Castor

@grandepaci are you able to show the full error and perhaps a screenshot of your In-DB formula tool configuration? Thanks

kuoshihyang
7 - Meteor

Try streaming your data out using a Data Stream Out tool to the workflow, pass the data into a regular formula tool with your Left and Substring functions then stream the data back after the data is transformed and cleansed using Data Stream In if you need to pass it back to your in-db database call.  

DSzivropulosz
5 - Atom

Hi There,

 

I would have done it this way:

DSzivropulosz_0-1668767501360.png

 

Magneto_
7 - Meteor

@DSzivropulosz I think he already tried that

apathetichell
18 - Pollux

https://stackoverflow.com/questions/11309247/left-function-in-oracle#:~:text=LEFT%20is%20not%20a%20f....

 

functions in formula db must be used in the db's native sql. 

 

SUBSTR would have worked.

Labels