Table Records with dynamic columns

Table Records with dynamic columns

Hi guys,

I need to have table records where the columns are dynamic and I have no more ideas on how to do it.

Just as an example, imagine you have some products, and you can have n dates for delivery. What I need is to have a product by line with all the dates requested for delivery by column, and an input field by product/date for quantities (see attached image)

Does anyone have done something similar to this that can help me?

Thanks in advance
Hi Pedro,

Do you have a maximum number of Delivery Date columns (I suppose you must have, otherwise the table will become highly user unfriendly)?

The best way to solve this is to do it by using a TableRecords with he maximum number columns where you hide the ones that you do not want to have visible (the last ones).

To do that, create a ProductAndDeliveryDates structure that represents the product and its N datetime fields for the delivery date (where N is the maximum number of date fields you can get) - that would be Deliverydate1, DeliveryDate2, etc.

On the action where you load the Table Records in your screen, get your list of products and respective delivery dates from the database. Iterate that list, and for each product and delivery dates, fill in the corresponding ProductAndDeliveryDates  record and add it to a ProductAndDeliveryDates_List.

On your screen, create a TableRecords with N columns for DeliveryDates. In case you should only show Z columns, you should hide the last two columns (giving all the cells an invisible style). To do that, simply create an extended property named style both on the header and line cells of the table records with the expression:

If(<CurrentColumn> <= Z; "display: table-cell;"; "display: none);

For example, in the third date column cells (header and line) you would put If(3 <= Z; "display: table-cell;"; "display: none);

This way, the cells where the number is higher that 4 will not be displayed (attention: the column numbers 1, 2, 3 are in fact hardcoded in each column).

If the number of delivery dates to show varies by product, just create a NumberOfDeliveryDates field in the ProductAndDeliveryDates record and set the expression to something like:

If(<CurrentColumn> <= TableRecord.List.Current.ProductAndDeliveryDates.NumberOfDeliveryDates ; "display: table-cell;"; "display: none);

This way the maximum number varies for each line.

I hope this information helps.

Best Regards,

Daniel Lourenço
Hi Daniel,

Thank you for your suggestion.

That’s what I’m going to do.

Best regards,
Pedro Alcântara
Hi Pedro\Daniel,
Could you please attach oml if you have implemented "Table Records with dynamic columns" ?
If you can do it will be helpful for me.



Hi Sahshi,

What I have done at the time was just following Daniel's advice.

Try to get your columns as row and then render it inside a webblock with float right and it this way you can show how many columns you want to show. Need to work on query part to get the column as row.
Shashi as we discussed , i think you already implimented this successfully.

Pedro Alcântara wrote:

Hi Sahshi,

What I have done at the time was just following Daniel's advice.



Can you help me with the OML for dynamic structure columns.