Subject Re: [IBO] How can I...
Author André Poisson
Helen, here we go.

This is the the KeySource :
SELECT ADM_NOBENEFICIAIRE
, ADM_NOADMISSION
, ADM_NOSEJOUR
, ADM_DATEDEBUT
, ADM_STATUTPAYEUR
, ADM_NOCENTRE
, ADM_REGIONADM
, ADM_REFERENT
, ADM_AGE
, ADM_ETATCIVIL
, ADM_NATIONALITE
, ADM_NOPASSEPORT
, ADM_DATEEXPIRATION
, ADM_CONFESSION
, ADM_SCOLARITE
, ADM_ADRESSE
, ADM_ADRESSE2
, ADM_VILLE
, ADM_ETAT
, ADM_PAYS
, ADM_CP
, ADM_TELMAISON
, ADM_TELBUREAU
, ADM_CU_NOM
, ADM_CU_ADRESSE
, ADM_CU_VILLE
, ADM_CU_ETAT
, ADM_CU_CP
, ADM_CU_PAYS
, ADM_CU_TELMAISON
, ADM_CU_TELBUREAU
, ADM_CU_LIENPARENTE
, ADM_DROGUEPRINCIPALE
, ADM_DROGUEFREQUENCE
, ADM_DROGUESECONDAIRE
, ADM_DROGUEDUREE
, ADM_DROGUEMODE
, ADM_EMP_NOM
, ADM_EMP_DEPUIS
, ADM_EMP_GENRE
, ADM_EMP_TYPE
, ADM_EMP_PRESTATION
, ADM_EMP_REVENU
, ADM_EMP_DIFFICULTES
, ADM_EMP_TELBUREAU
, ADM_FAC_NOM
, ADM_FAC_ADRESSE
, ADM_FAC_VILLE
, ADM_FAC_ETAT
, ADM_FAC_CP
, ADM_FAC_PAYS
, ADM_FAC_TELMAISON
, ADM_FAC_TELBUREAU
, BEN_NOM
, BEN_PRENOM
, BEN_NAS
, BEN_NAM
, BEN_SEXE
, BEN_DATENAISSANCE
, BEN_NOMPERE
, BEN_NOMMERE
, BEN_LIEUNAISSANCE
, BEN_PAYSNAISSANCE
, BEN_LANGUE
, BEN_LANGUE2
FROM ADMISSIONTEMPORAIRE

This is the Lookup:
SELECT ITEMCODE
, DESCFRANCAISE
FROM LISTELANGUE

For example this will put ITEMCODE in the field BEN_LANGUE.

But if this Stored Procedure does not return null or empty for BEN_NOBENEFICIAIRE
(input out output parameters not here)
BEGIN
SELECT BEN_NOBENEFICIAIRE
, BEN_NOM
, BEN_PRENOM
, BEN_NAS
, BEN_NAM
, BEN_SEXE
, BEN_DATENAISSANCE
, BEN_NOMPERE
, BEN_NOMMERE
, BEN_LIEUNAISSANCE
, BEN_LANGUE
, BEN_LANGUE2
FROM BENEFICIAIRE
WHERE BEN_NOBENEFICIAIRE = :IN_BENNO
INTO
:BEN_NOBENEFICIAIRE
,:BEN_NOM
,:BEN_PRENOM
,:BEN_NAS
,:BEN_NAM
,:BEN_SEXE
,:BEN_DATENAISSANCE
,:BEN_NOMPERE
,:BEN_NOMMERE
,:BEN_LIEUNAISSANCE
,:BEN_LANGUE
,:BEN_LANGUE2;
SUSPEND;
END

then I do this:

with IBSP_BenInfo do
begin
if Prepared then UnPrepare;
Prepare;
ParamByName('IN_BENNO').asString := IBE_NoDossier.Field.Value;
ExecProc;
if ParamByName('BEN_NOBENEFICIAIRE').AsString <> '' then
begin
IBE_Nom.Field.Value := ParamByName('BEN_NOM').AsString;
IBE_Prenom.Field.Value := ParamByName('BEN_PRENOM').AsString;
IBE_NAM.Field.Value := ParamByName('BEN_NAM').AsString;
IBE_NAS.Field.Value := ParamByName('BEN_NAS').AsString;
IBLC_Sexe.DataSource.Dataset.FieldByName('BEN_SEXE').AsString := ParamByName('BEN_SEXE').AsString;
IBE_DateNaissance.Field.Value := ParamByName('BEN_DATENAISSANCE').AsString;
IBE_NomPere.Field.Value := ParamByName('BEN_NOMPERE').AsString;
IBE_NomMere.Field.Value := ParamByName('BEN_NOMMERE').AsString;
IBE_LieuNaissance.Field.Value := ParamByName('BEN_LIEUNAISSANCE').AsString;
IBLC_Langue.DataSource.Dataset.FieldByName('BEN_LANGUE').AsString := ParamByName('BEN_LANGUE').AsString;
IBLC_Langue2.DataSource.Dataset.FieldByName('BEN_LANGUE2').AsString := ParamByName('BEN_LANGUE2').AsString;
end; // not ParamByName('OUT_NOBEN').IsNull
end; // with IBSP_BenInfo

fields with starting with IBLC are Lookup Combo.

I would like to thank you in advance for the marvelous job you do of helping dum users like me.

André



----- Original Message -----
From: Helen Borrie
To: IBObjects@yahoogroups.com
Sent: Tuesday, August 28, 2001 12:27 AM
Subject: Re: [IBO] How can I...


Andre,

At 12:02 AM 28-08-01 -0400, you wrote:

>I would like to update the fields as sonn as possible. As an example, when the user enters a social insurance id, in a TIB_Edit field, I do a request on the database and if the id is present I pick up some values and assign them to different TIB_Edit fields, and some of those fields are IB_LookupCombo.

Let me try to understand this. You have three datasets:
(1) the Main (Keysource) rows
(2) the lookup, which is connected through KeyLinks to one column in the Keysource dataset
(3) one that takes as an input parameter the ID entered by the user and queries a different table. If it finds a match, it outputs some columns, which you then plug in to some columns in the other two datasets.

>So I would like to enter immediatly the value that was returned by my query in the TIB_LookupCombo.

This I don't understand. Are you saying that you want to create a new row in the lookup dataset? or are you saying that you want to find a key value in the lookup dataset that matches the value returned?


>I know that if I do the following:
>IBLC_Langue.DataSource.Dataset.FieldByName('ITEMCODE').AsString := ParamByName('BEN_LANGUE').AsString;
>The dataset of the LookupCombo for the lookup dataset will be updated with the new value

The lookup dataset should not get updated. Its function is to provide a value corresponding to a key that is searched for by the main (keysource, parent) dataset via the lookup key, i.e. the column that it stores as a key to that link. The lookup dataset's KeyLinks property points to that key.

>What I would like is the equivalent but to update the KeySource:
>What could I put after IBLC_Langue.???.FieldByName('BEN_LANGUE').AsString := bla, bla, bla;
>Does this make sense?

Not yet, but we are getting there. Could you show the SQL for each of the three queries, please, and also the KeyLinks of the lookup dataset?

Regards,
Helen

All for Open and Open for All
InterBase Developer Initiative · http://www.interbase2000.org
_______________________________________________________

Yahoo! Groups Sponsor
ADVERTISEMENT




Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]