Is it possible to give the field name dynamically to a list?

Hi,

I am having a HeaderList which contains the field names of the GetAllVehiclesForSale List. How can I assign the fields dynamically using the field from header list? Is it possible? I want to implement something like in the snap shot.

Can someone point me to any instructions on how to implement this?

Thanks,

Anjitha Mohan

Hi Anjitha,

What you are trying to do is not possible, and shouldn't be attempted - the Platform wasn't made with dynamic columns in mind. Can you explain a bit more about the functionality you are trying to implement? Why do you want to have dynamic headers?

Kilian Hekhuis wrote:

Hi Anjitha,

What you are trying to do is not possible, and shouldn't be attempted - the Platform wasn't made with dynamic columns in mind. Can you explain a bit more about the functionality you are trying to implement? Why do you want to have dynamic headers?

Thanks for the reply Kilian Hekhuis..

I need to populate data for an ag-Grid component, for this the columns are populated like below. I am assigning  the list variables based on the header field name. Just thought of populate it dynamically so that I can reduce the number of if's.



Solution

Hi Anjitha,

I see. Unfortunately, this is, like I said, not possible. Theoretically you could write an Extension that uses reflection to do this, but I wouldn't advise it unless you have extensive C# experience.

Note you could also use a Switch instead of all the Ifs, and perhaps you could also create an Action that has the Switch/Ifs so it doesn't clutter up your main code.

Solution

Kilian Hekhuis wrote:

Hi Anjitha,

I see. Unfortunately, this is, like I said, not possible. Theoretically you could write an Extension that uses reflection to do this, but I wouldn't advise it unless you have extensive C# experience.

Note you could also use a Switch instead of all the Ifs, and perhaps you could also create an Action that has the Switch/Ifs so it doesn't clutter up your main code.

Thanks for your help.. In c#, It is possible to implement it, so I was thinking of trying it in outsystems.. I will try to implement your suggestions.

Cheers!!

Anjitha Mohan


Thanks for the feedback. Happy coding!