Jump to content


Photo

[Grid] Allowing dots in column names


  • Please log in to reply
1 reply to this topic

#1 littlebigfred

littlebigfred
  • Members
  • 176 posts

Posted 10 August 2009 - 07:58 PM

Hello

I guess it's not a major request, but it'd be nice if it were possible to use dots in column names, so that we can assign SQL names ("product") to grid column names, while using beautified names for column captions ("My Product").

This is currently not possible when JOINing two or more tables since the grid doesn't allow dots in column names (eg. table1.label, table2.price):

CODE
Query := 'SELECT ';

MySL := TStringList.Create;

//To allow for spaces in values
MySL.StrictDelimiter := True;

//SELECT table1.label, table2.price FROM table1,table2 WHERE table1.id=table2.id"
MySL.CommaText := 'table1.label="Product Label",table2.price="Product Price"';

for index := 0 to MySL.Count - 1 do begin
    NextGrid1.Columns.Add(TNxTextColumn,MySL.ValueFromIndex[index]);

    //Project1.exe raised exception class EComponentError with message '''table1.label'' is not a valid component name'.
    NextGrid1.Columns[index].Name := MySL.Names[index];

      Query := Query + Format('%s,',[NextGrid1.Columns[index].Name]);

end;

MySL.Free;

//Remove trailing comma
System.Delete(Query, Length(Query), 1);
ShowMessage(Query);


My .15€

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,742 posts
  • Gender:Male

Posted 11 August 2009 - 06:10 PM

Hello Fred,

Column names are using same mechanism as other Delphi controls and this mean that dot can not be used in name.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users