Subject | Re: [IBO] TIB_Query and KeyLinks via Delphi Code |
---|---|
Author | Helen Borrie |
Post date | 2003-03-12T00:07:45Z |
At 02:03 PM 11/03/2003 -0800, you wrote:
object exists, the KeyLinks structure is already created.
Just do
...with MyQuery.KeyLinks do
Add('AFF_CODE');
Add('DEDUCT_CODE');
.... and so on
confusing, but the TI sheet "Working with Fields & Params" explains how to
use the link entry convention for applying the various types of
dataset-to-dataset field linkages at runtime, where you can't otherwise get
to them as distinct properties.
If you are applying the "two-sided keylinks" to implement the relationship
from a lookup dataset to a column in a parent dataset which is pointed to
via the KeySource property, then your strings need to be
...
with MyLookupQuery do
KeySource := TheParentQuery.Datasource;
with KeyLinks do
Add('AFF_CODE=TheParentTable.Aff_Code');
Add('DEDUCT_CODE=TheParentTable.Deduct_Code');
.... and so on
You can optionally include qualifiers for the lookup table keys but for the
parent table keys they are mandatory. I always use qualifiers on both
sides myself.
But it's not clear which application of KeyLinks you are having the
problems with...
Helen
>Hi Group;You don't need this for the "ordinary" use of KeyLinks: once the ib_query
>
>I am getting the following error when I try to set
>TIB_Query KeyLinks via code in Delphi.
>
>Project __ raised exception class EIB_Error with
>message 'Invalid KeyLink Entry' TBL_AK.AFF_CODE
>Process stopped, Use step or Run to continue.
>
>I am trying to do this in code because the user has
>the ability to select from 52 tables and each table
>has the same 3 search fields (ID, Name, City). It
>would be difficult to arrange 156 TIB_Query Components
>on a data module page. This is to get 9
>TIB_LookupCombo Boxes to work.
>
>Some of my code is as follows:
>
> KL_Main : TIB_StringList;
>...
> tblName : string;
>...
> tblName := 'TBL_AK';
>...
> KL_Main := TIB_StringList.Create;
> KL_Main.Add((tblName + '.AFF_CODE'));
> KL_Main.Add((tblName + '.DEDUCT_CODE'));
> KL_Main.Add((tblName + '.ORG_CODE'));
> KL_Main.Add((tblName + '.OFFICE_CODE'));
> KL_Main.Add((tblName + '.ASSET_CODE'));
> KL_Main.Add((tblName + '.INCOME_CODE'));
> KL_Main.Add((tblName + '.FILING_CODE'));
> KL_Main.Add((tblName + '.ACCT_PRDS'));
> KL_Main.Add((tblName + '.FOUND_CODE'));
>...
object exists, the KeyLinks structure is already created.
Just do
...with MyQuery.KeyLinks do
Add('AFF_CODE');
Add('DEDUCT_CODE');
.... and so on
> mainDM.ibq_Main.KeyLinks := KL_Main;NB. You should use Assign to pass the strings of one TStrings to another.
>This coding generates the error. I went to the helpThis isn't syntax, it's a descriptive convention for parsers. I know it's
>file for TIB_StringList Object and now I am thoroughly
>confused. Is the help file telling me that for each
>keyLink entry, the following is required (using the
>syntax from the help file)?
>
><link entry> ::= <link name>=<link value>
><link name> ::= [<table name>.] <column name>
><link value> ::= (<string literal>|<param list>)
confusing, but the TI sheet "Working with Fields & Params" explains how to
use the link entry convention for applying the various types of
dataset-to-dataset field linkages at runtime, where you can't otherwise get
to them as distinct properties.
>What would be a valid code entry in Delphi?You don't need this stuff for KeyLinks.
>
> KL_Main.Add((linkEntry1=linkName1=linkValue1));
>
>where linkEntry1 is an arbitrary name,
>linkName1 = affiliation = TBL_AK.
>linkValue1 = AFF_CODE
>all assigned to TStrings prior to the add procedure.
If you are applying the "two-sided keylinks" to implement the relationship
from a lookup dataset to a column in a parent dataset which is pointed to
via the KeySource property, then your strings need to be
...
with MyLookupQuery do
KeySource := TheParentQuery.Datasource;
with KeyLinks do
Add('AFF_CODE=TheParentTable.Aff_Code');
Add('DEDUCT_CODE=TheParentTable.Deduct_Code');
.... and so on
You can optionally include qualifiers for the lookup table keys but for the
parent table keys they are mandatory. I always use qualifiers on both
sides myself.
But it's not clear which application of KeyLinks you are having the
problems with...
Helen