Subject | Re: [IBO] Changing MasterLinks at runtime |
---|---|
Author | Helen Borrie (TeamIBO) |
Post date | 2002-05-07T02:13:50Z |
At 04:18 PM 06-05-02 -0500, you wrote:
you want to reassign is MasterSource.
Write a procedure called something like "SwitchDetails", to which you pass
the reference to the detail set you want to switch to. You need to
complete any outstanding work on the "live" detail set, then close
it. Then simply swap over the MasterSource property.
MyDataModule.SwitchDetails(aQuery: TIB_Query);
begin
with aQuery do
begin
if MasterSource <> nil then
Exit; // because it's already the right one
if Name = 'qryPurchase' then
qrySale.MasterSource := nil
else
qryPurchase := nil;
MasterSource := dsMaster; // the datasource of the master set
end;
end;
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com
>I need to change MasterLinks at runtime. The two possibilities are:You don't touch the MasterLinks of either detail set at all. The property
>
>FRTLANE.ORIG_ID=CONTRACT.LOC_ID
>or
>FRTLANE.DEST_ID=CONTRACT.LOC_ID.
>
>The MasterLinks need to change if the user changes the contract type from
>"Purchase" to "Sale". How do I change the links and refresh the FRTLANE
>dataset?
>
>I see that the MasterLinks are a TIB_StringList, and I can .Clear or .Add
>them, but am not sure where to go from there.
you want to reassign is MasterSource.
Write a procedure called something like "SwitchDetails", to which you pass
the reference to the detail set you want to switch to. You need to
complete any outstanding work on the "live" detail set, then close
it. Then simply swap over the MasterSource property.
MyDataModule.SwitchDetails(aQuery: TIB_Query);
begin
with aQuery do
begin
if MasterSource <> nil then
Exit; // because it's already the right one
if Name = 'qryPurchase' then
qrySale.MasterSource := nil
else
qryPurchase := nil;
MasterSource := dsMaster; // the datasource of the master set
end;
end;
regards,
Helen Borrie (TeamIBO Support)
** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com