Forum Discussion
1 Reply
- Colin_McCraeCommunity Hero
This is a Delphi SyncFusion grid right?
In which case, there are two possibilities.
You car try getting the display name, which is stored in (C# Script notation):
<Grid_Object>["Columns"](Column_Number)["DisplayLabel"]
But that may not always be populated. If it's not, it will come back empty. In that case, you need to look through the underlying dataset object as the displayname will inherited from that.
To get that, you need the field value name from the grid column:
<Grid_Object>["Columns"](Column_Number)["FieldName"]
Which will give you a field name. You then need to iterate through the fields in the recordset looking for a field name which matches the above value. When you hit a match, get the displayname of that field.
To get the column field name:
<Grid_Object>["Columns"](Column_Number)["FieldName"]
and number of fields in the dataset (there may be hidden ones - you can't rely on the on-screen visible count):
<Grid_Object>["DataLink"]["DataSet"]["FieldList"]["Count"]
and use this number to iterate through the dataset fields/columns:
<Grid_Object>["DataLink"]["DataSource"]["DataSet"]["Fields"]["Fields"](Field_Number)["DisplayName"]
Which should match the on screen column name.
Which one works will vary depending on your developers. In the Delphi app I'm working on, I have to use a mixture of both as it's not consistent. So I check the grid display label first. If it's blank, I drop into a secondary routine which looks for a match with the field name.
Related Content
Recent Discussions
- 2 days agovladd1