I have a situation that I need to change the filed names (column names/labels) in a grid (in a Form) with a given new name. I have a temp table that has the values that I iterate through and for each value, in the temp table, I need change some of the Form’s fields names with the text that I have in the temp table (something like trying to pivot the data). Any ideas on how to go about it?
Change the AutoDeclaration property of the column to Yes, which will allow you to use it in code by name.
Then simply change the value of its label property, such as MyColumn1.label(“New label”).
Hi Martin, I have all the AutoDeclaration property of the columns have been set to Yes. My scenario is a bit different. I am trying to see if I can identify the column based on the FieldId and then be able to change the label of the column? Just sent you an email with the code explaining my scenario.
Hi Dave, please keep the discussion here. It’ll allow others to share their experience and others with a similar problem (maybe several years later) will benefit from the discussions being public.
One option is changing your design. You could iterate grid columns, get field names from them (DataField property), convert them to field IDs and used them for other purposes.
If you start with field IDs, you can iterate the grid to find the column with DataField corresponding to the ID. To avoid doing it every time, you can cache the result in a map. Or you can even prepare the mapping manually.