Display text out of text list

Display text out of text list

  

Hello,


I receive a text list from my Rest API and I want to output the elements of this list in a List Record widget.

But after I set the Source Record List to the list from the API I have to drag an entity or attribute to the widget otherwise it doesn't show anything on the web page. 

How can I just show the elements of a text list to a page, am I missing something essential?


Kind regards,

Joeri

Hi Joeri,

Just drop an expression inside your List Records widget and set its Value to something like:

TextList.Current

Where "TextList" is your list variable.

Actually Joeri,

Aurelio's answer is almost correct... but is using the wrong list. After you've set the Source Record List to the list returned from the API you, you drag an Expression inside your List Records, and then set the Expression's value to:

ListRecords1.List.Current

Where "ListRecords1" is your List Records widget's name.

The reason using this list is relevant, is the ListRecords1 will iterate it's List local variable, not the list you assigned to Source Record List.

Thanks for the correction Jorge!

I read that tip just the other day in the Performance Best Practices guidelines. Looks like I need to read it again! :)

Thanks guys, that worked! But this method doesn't work in an Editable Table right? Because that is what I actually need. Or do I need to change something else then?

@Aurelio, can you point me to that Performance Best Practices tip? I'm curious now...

@Joeri, I don't see why it wouldn't work in an Editable Table... if you want the text to be editable instead of using an Expression and setting it's Value, just use an Input widget, and set it's Variable to

Table1.List.Current

Where "Table1" is your Editable Table widget's name.

Solution

Hi Joeri,

You first need to click one of the "Add Column" buttons before you can drag the Expression:

Solution

@Jorge: it was actually part of this Master Class. The whole thing is very interesting and worth a watch (if you have almost 3 hours to spare ;) ), but the relevant part is around the 02:07:51 mark.

@Aurelio: The Master Class actually describes what I've just stated above... maybe a re-watching is in order? ;)

@Jorge: I know! That's what I said in my second post. I was actually agreeing with you and admitting that maybe it's time for me to revisit that master class.

Kilian Hekhuis wrote:

Hi Joeri,

You first need to click one of the "Add Column" buttons before you can drag the Expression:

This works for a normal Table Record widget, but if I try this method with an Editable Table widget I get the following compiler error:

Internal Error
Compilation Error.
RuleDetail.aspx.cs(539,44): error CS0029: Cannot implicitly convert type 'string' to 'OutSystems.HubEdition.RuntimePlatform.Db.IRecord'
wtTable1_rows.CreateRecordDelegate = () => new string(null);
RuleDetail.aspx.cs(539,44): error CS0121: The call is ambiguous between the following methods or properties: 'string.String(char[])' and 'string.String(char*)'
wtTable1_rows.CreateRecordDelegate = () => new string(null);
RuleDetail.aspx.cs(539,44): error CS1662: Cannot convert lambda expression to delegate type 'System.Func<OutSystems.HubEdition.RuntimePlatform.Db.IRecord>' because some of the return types in the block are not implicitly convertible to the delegate return type
wtTable1_rows.CreateRecordDelegate = () => new string(null);

State: Second stage compilation

Jorge Martins wrote:

@Aurelio, can you point me to that Performance Best Practices tip? I'm curious now...

@Joeri, I don't see why it wouldn't work in an Editable Table... if you want the text to be editable instead of using an Expression and setting it's Value, just use an Input widget, and set it's Variable to

Table1.List.Current

Where "Table1" is your Editable Table widget's name.


It just won't let me drag an expression or input field to the table...

Joeri Klomp wrote:

This works for a normal Table Record widget, but if I try this method with an Editable Table widget I get the following compiler error:

Internal Error
Compilation Error.

Hi Joeri,

This seems like a Platform error, nothing what you are able to do in Service Studio should ever result in a compilation error! I can confirm that the compilation error exists, as I can reproduce it. As a workaround, you could create a Structure with a single Text attribute for the Editable Table, and after retrieving the Text List from the REST API convert it to a list of that Structure.


Hi Kilian,

So is this a kind of bug on OutSystems side? If so, shouldn't we report it then?

And thanks for the workaround, I will try that instead then.

Hi Joeri,

I already reported it, but it wouldn't hurt if you did so as well :). Let me know if the workaround works.

Will do :)

Do you have a link where I can report it or should I just email them?

You could do either, depending I think on your licence model. At https://www.outsystems.com/SupportPortal/Support/ there's your support portal where you can create a new case, otherwise just send an e-mail to support@outsystems.com.

Thanks, I will do that! 

The workaround works with an editable table by the way, implemented a server action which takes a text from a list and converts it to a struct with a text attribute like you said :)

Ok, great to hear it works! Could you mark my answer as "Solved" so this topic doesn't continue unsolved? Thanks.