379
Views
6
Comments
Solved
Convert Text List to Text Literal List
Application Type
Reactive
Service Studio Version
11.54.12 (Build 62475)

Hi, I want to convert a Text List to Text Literal List to use in BuildSafe_InClauseTextList.

I have read these forums, 

but the answers provided didn't work for me.

Below is my logic flow:

I want to convert the Text List that I get from the client action to Text Literal List by appending it to a TextLiteral List local variable.

Inside the data action, the BuildSafe action will use the TextLiteral List local variable as input.


But when I'm appending the list, the data type error still shows.

Are the answers provided in the forums above not valid anymore? Or did I miss any steps here? 

I just don't really get what is TextLiteral type, based on the documentation, TextLiteral is also taking Text data type, so why can't the Sanitization API just uses a normal Text data type instead of creating a structure for it?  

Thank you.


2020-11-25 10-45-32
Mostafa Othman
Champion
Solution

Hello Max,

I used a Foreach loop and ListAppend to add element by element from Text list to TextLiteral list as screenshot below 


UserImage.jpg
Max Chia

Hi Mostafa,

Thank you for your solution, it works perfectly. Do you know why is ListAppendAll not working like the old forums' answers?

2020-11-25 10-45-32
Mostafa Othman
Champion

If you checked back the first post you added to your question, you will find he is using ListAppened not ListAppendAll 


For the second post he is using aggregate results which is working fine with AppendAll as in this case OutSystems allow you to map value from aggregate to value of your TextLiteral List.


Also as a solution for your situation you can create structure named parameters and inside it attribute but don't name this attribute "Value" for example name it "ParameterValue" and use List of Parameters instead of List of Text in this case you will be able to use AppendAll and map your value from Parameter list to TextLiteral List.

When you use Text List your attribute name will be Value so when you use AppendAll OutSystems automatically tries to map your value to TextLiteral value which as attributes have same name "Value" into two lists so this automatic assignment found data types are different so it raise this error.

I hope I could give you the idea correctly.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

very interesting observation, @Mostafa Othman 

good tip to not use the name 'Value'

This sounds like a bug in the platform/service studio to me, do you know if this was reported or put in as an idea yet ?

Dorine

2020-11-25 10-45-32
Mostafa Othman
Champion

Thank you @Dorine Boudry.

I am not sure if this is reported as idea or not but I will try to look for it and see if it is already exist to vote for it.

2020-11-25 10-45-32
Mostafa Othman
Champion

Dear @Dorine Boudry and @Max Chia 

Actually I just tried multiple scenarios to make sure that attribute name 'Value' is the issue but I found not.

It seems the issue while using list of basic types and trying to append it to list of structure with attribute with same type.

I created my own structure 'TextStruct' with attribute 'Value' of type Text and I am able to append list of that structure using ListAppendAll.


So I am sorry for my wrong assumption into my first reply without more testing and investigation.

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