530
Views
3
Comments
Solved
Converting Text to TextLiteral
Question

Hi all,

im trying to use the BuildSafe_InClauseTextList . but seems it is requiring of type TextLiteral.

i need to dynamically add on a list of texts into my IN clause,

for below snippet, i created a TextLiteral List, and used ListAppendAll, element [0] = "SomeText",  but i cant add text to it as per instruction below. 

it will prompt error "TextLiteral" data type required instead of text"

ListA[0].Value = "John Doe"
ListA[1].Value = "Mary O'Hara"
BuildSafe_InClauseTextList(ListA) = "'John Doe','Mary O''Hara'"


links below are my references.

https://success.outsystems.com/Documentation/Best_Practices/Development/Building_Dynamic_SQL_Statements_the_Right_Way


https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/Sanitization_API?_gl=1*1qybgxe*_ga*MTQ4MzgxOTcuMTY0MDU3Nzk1NQ..*_ga_ZD4DTMHWR2*MTY1NDIzMTU0Ny42MS4xLjE2NTQyMzQ1MTYuNjA.#Structure_TextLiteral

UserImage.jpg
vikas sharma
Champion
Solution

You need to do create a list of textLiteral. Add value in those text literals and then pass this list to BuildSafe_InClauseTextList.

UserImage.jpg
Nagoya

do u know how to use the "BuildSafe_InClause TextList"  from Sanitization api ?

it seems the return value is e.g "'Test'"    or     "'Test1','Test2'"  .

however when using the advanced SQL test. it will not return any results by "'Test'" , instead i can search for is "Test" . 

and if there is no result, "''". meaning this will always come in as no results ?

UserImage.jpg
Nagoya

nvm, after changing expand inline to yes, seems to work

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.