How to update table cell dynamically with text only known at runtime?

How to update table cell dynamically with text only known at runtime?

  

I have an editable table with a column that I want to contain numbers starting from 1 onwards.  How many I want will only be known at runtime (i.e. the LineCount).

Basically what I want to do is the equivalent of (in programming speak)....


Loop iCount <= iLineCount

     MyCell(iCount).Text = IntegerToString(iCount)


I can't see how to do it using an Assign or in the Properties and I can't see any inbuilt functions that I can call to increment a variable by 1 each time.  Can anyone point me in the right direction please?

Hi Sienna,

Maybe a possibile solution is to have a runtime action to be called after screen is loaded or everytime something changes in the table. That action could read the table content, assign a variable to expressions in the table, and run a refresh action.

Regards,

So sorry if I'm being daft here but I'm not following.  How do I assign it?  I already have a variable containing the LineCount but I don't know how to enter the cell text with numbers 1 to LineCount (i.e. each cell in the column will have a different number).

Hi Sienna,

In editable table there is an event "OnRowSave". There you can do your logic to update the table content.

Regards,

Thank you, however it looks to me that all I can do via On Row Save is point to a server action, however I already have a server action in which to do my logic, the problem is that I don't know how to implement the logic in an Outsystems fashion.

Solution

Hi Sienna,

Then I suggest you can take a look in this OutSystems document to know how you can change Tables content in OutSystems: 

https://success.outsystems.com/Documentation/10/Developing_an_Application/Implement_Application_Logic/Use_a_For_Each_to_Iterate_a_List

Regards,

Solution

This is exactly what I'm after, thank you!  However I cannot see a named expression widget from inside an assign in order to set the value, I can only see attributes of the entity assigned to the table, not the column that I want to populate dynamically with the numbers and which isn't linked to any entity or attribute.

Great!

You can give names to widgets and they will appear on that case.

Do this naming for the needed widgets in the table:

Regards,

Sienna Davids wrote:

....I cannot see a named expression widget ....

As mentioned that is my problem, I have named it but still can't see it from within the assign?


Hi Sienna,

Steps:

1. Add a column to table

2. In the source record list, add a new attribute with to hold that number

3. Assign the expression in that column to a new attribute of the source record list

4. Use the On Row Save event action to iterate the table and assign the data you need.

I hope this helps!

Regards,




Thanks!  I did initially create a row number attribute but then, for whatever daft and unknown reason, I somehow thought I must be doing something wrong and felt that I should be able to view a named attribute.

I've implemented the new attribute but not tested it yet because I'm unable to create the entity linked to the aforementioned table in order to populate the other columns.  Can I ask if you know why an entity would only have a 'Get...' server action available when it is NOT a static entity, and yet I can see the usual 'Create...', 'Update...', etc. server actions available for that entity in the core module, but it's not visible in my responsive module and the latest version of the core module has been published and there are no dependency updates available?

Hi Sienna,

Good to know you are doing progress.

Regarding your question, when you set enitity to be public, then in consumer modules all methods will be available (not only Get method).

This document show the illustrations to answer your question:

https://success.outsystems.com/Documentation/10/Developing_an_Application/Reuse_and_Refactor/Expose_and_Reuse_Code_Between_Modules

Regards!

My entity is already set as public but I can still only see the Get method.  Surely I wouldn't see the entity at all if it wasn't public, not even the Get method?


In case anyone needs to know, I found out my problem.  Where I had the slider set, it looked like I had a property called 'Expose' set to 'Yes' which is what I thought I wanted.  However it is of course 'Expose Read Only' and I don't want that lol.