335
Views
10
Comments
Solved
Create a table on screen dynamically (expand the columns)

For my design having 3 entities:

1. Role entity to store the role information.

2. Bar entity to store the side menu bar (navigation Bar) Parents items, and child items.

3. Role Permission entity to store which role has the page access permission.

I wish to create a table on screen, the first column is Nav Name (From Bar), Parent Name (From Bar), then the problem is how to populate the columns based on the List from Role entity. (it means how many roles on the Role entity, it will create how many column of the screen table)

For example, the role entity has 3 roles, then the total columns of the table on screen are 5 (2 fixed columns that mention above)  





Screenshot 2023-11-24 152913.png
Screenshot 2023-11-24 152935.png
Screenshot 2023-11-24 152833.png
Screenshot 2023-11-24 154239.png
Bar.oml
UserImage.jpg
Martin Woon
Solution

Dear community members,

I apologize for the delayed response. I sincerely appreciate your valuable suggestions. However, after careful consideration, it appears that the provided solutions may not entirely align with the specific requirements of my task.


Recently, I'm taking a phased approach to my work, and my initial focus is on expanding the attributes/columns. The further discussion will be open a new question to continue the task, I try to break down the task into small pieces to hit the point more easily. Your continued support and insights are immensely appreciated. 


For those who share an interest in dynamic tables, I've discovered an existing solution that effectively addresses the need for dynamically creating tables. I encourage you to explore this option:


  1. Dynamic Table - Reactive:
    comment: Reactive App, But not have the logic provide, need to build It yourself.
    https://www.outsystems.com/forge/component-versions/16197/version/0/platform/
  2. Dynamic Table - Traditional     Web:
     comment: It has provide a sample app for us, but cannot directly use in Reactive app.
    https://www.outsystems.com/forge/component-overview/3669/dynamictable


Best regards,

Martin.



2023-08-28 07-00-10
Paulo Torres
Champion

Hello Martin,

Do you want to create physical fields in database dynamically?

If it's the question you don't have any option to do that.

Regards

UserImage.jpg
Martin Woon

Hi Paulo Torres, 

What I hope to achieve is just populate the columns of table on the screen based on the list of my Role entity during run time. 

For example, if I add a new record in the Role entity (original 3 -> 4), the table on the screen will populate a new column. (From 5 columns -> 6 columns [add 1 more role column in the table behind])

Regards

Screenshot 2023-11-24 154239(1).png
2023-08-28 07-00-10
Paulo Torres
Champion

But it seems you want a new column if you add a new role, no?

UserImage.jpg
Martin Woon

Partially correct, when a new role added, the columns should be added also. However, in the ideally solution the table on screen is not exactly same as the entity. The table on screen is set up as the picture that provided above, but the data is fetch from different entity. With the Role Permission entity, ideally will not create the physical field on the database, just add a record/ change the record once the user make changes.


a) Nav Name (from bar entity to display all the item) vertical expend
b) Role Name (put in Header cells from role entity to display all the item ) horizontal expend
c) Checkbox (Let the checkbox be true or false based on record from Role Permission Entity) 

2020-11-10 07-09-26
Dadi

Hi @Martin Woon 


How about using advance SQL? but we still have to limit the role length because need to initialize output structure.

Let's say we make maximum as 5, so select those 5 roles in table, but hide them if we didn't have created that role record, actually it still not dynamic as well. Im just figuring out how

UserImage.jpg
Martin Woon

Hi Dadi,

Thanks for your idea, I haven't try it out before, I will update my progress for this suggestion.

Regards

2020-09-21 08-42-47
Vincent Koning

Are you sure that this is a wise UX decision? What it you have 10 roles? Or 15 roles? You table will run out of space and you will never be able to have enough columns since OutSystems doesn't allow dynamic adding columns. Yes, you can create a lot beforehand and hide them with logic but this is hard to maintain. I would not recommend this approach. 

I would look into an UX where the roles are listed vertically (table or list) instead of horizontally. This makes it easier to handle larger number of roles and you don't need to create logic to show or hide columns. Perhaps you could use the Master Detail widget and list all "From bar" names. In the right panel you then create a list or table with all the roles associated. This will make your life easier as this is really simple to create and for the users it is also easier to understand.

2020-11-10 07-09-26
Dadi

As @Paulo Torres describe before, there is no option to create physical fields in database dynamically.


Also agree that force conditioning this table with maximum column is not good, just wonder to catch with the requirement. But its still considered if the roles have small records.

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

@Martin Woon ,

As @Vincent Koning is saying, when the amount of roles becomes non-trivial, there will be a massive amount of information in the table, a lot of columns. 

Apart from the hassle of building/maintaining this, think about the task your users will execute with this UI, and why they would need to see all the roles of all people in one single go ??

If this is about giving a tool to understand and regulate quickly what users have a specific role, and what roles are given to specific users, and ability to compare roles among each other or compare users among each other, you could look into having 2 lists (2 separate screens, or maybe 2 tabs on a single screen)

1) a list of all users, with something like 3 columns for roles.  Have a dropdown in the header of the columns to allow your user to pick up to 3 roles for comparison.

2) a list of all roles, with something like 3 columns for users.  Have a dropdown in the header of the columns to allow your user to pick up to 3 users for comparison.

If you go up to 2 or 3, you wouldn't even have to pivot data or do some extensive merging of those roles into a single list, you could just have 2 or 3 WithOrWithout joins.

Dorine


UserImage.jpg
Martin Woon
Solution

Dear community members,

I apologize for the delayed response. I sincerely appreciate your valuable suggestions. However, after careful consideration, it appears that the provided solutions may not entirely align with the specific requirements of my task.


Recently, I'm taking a phased approach to my work, and my initial focus is on expanding the attributes/columns. The further discussion will be open a new question to continue the task, I try to break down the task into small pieces to hit the point more easily. Your continued support and insights are immensely appreciated. 


For those who share an interest in dynamic tables, I've discovered an existing solution that effectively addresses the need for dynamically creating tables. I encourage you to explore this option:


  1. Dynamic Table - Reactive:
    comment: Reactive App, But not have the logic provide, need to build It yourself.
    https://www.outsystems.com/forge/component-versions/16197/version/0/platform/
  2. Dynamic Table - Traditional     Web:
     comment: It has provide a sample app for us, but cannot directly use in Reactive app.
    https://www.outsystems.com/forge/component-overview/3669/dynamictable


Best regards,

Martin.



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