BCS Retrieve Data Element Label Info (no dfm)


This application retrieves the data element description stored in the database table as outlined in BCS Establish Display Label (frm020).
The function is listed below.
[codesyntax lang=”delphi”]

{*-----------------------------------------------------------------------------
  Procedure: RetTag
  Author:    Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC
  Date:      25-Jul-2016
  @Param     den: string
  @Return    string
-----------------------------------------------------------------------------}
function Tfrm022.RetTag(den: string): string;
var
  res: string;
begin
  ucon := TUniConnection.Create(Application);
  with ucon do
  begin
    Database := 'de';
    ConnectString :=
      'Provider Name=MySQL;Login Prompt=False;User ID=bcs;Password=' +
      'Password' + ';' + 'Data Source=localhost;Database=' + 'de' +
      ';Port=3306';
    Connected := true;
    LoginPrompt := false;
  end;
  uta := TUniTable.Create(Application);
  uta.Connection := ucon;
  uta.TableName := 'dl';
  uta.Open;
  if uta.Locate('dna', trim(den), []) then
  begin
    res := uta.FieldByName('lab').AsString;
  end
  else
  begin
    res := '';
  end;
  result := res;
  uta.Free;
  ucon.Free;
end;

[/codesyntax]
The component documentation can be found by clicking here.
The source code may be found by clicking here.
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *