Tip>Designer

An alternative to using sub-Dialogs

 

Article #:

0044

Contributor:

Ricky Burrell, Peter Ottermann

GF version:

4.0

Applies to:

Dialogs

Last updated:

January 10, 2003

Description

As an alternative to capturing data in a master Dialog that contains a number of embedded sub-Dialogs, one can instead maintain a set of "stand-alone" Dialogs and store the answers in a single master Answer-set.

Explanation

You can create a blank master Dialog and then use FillPoints within the template to link to the stand-alone Dialogs. With this solution, separate Answer-sets for each stand-alone Dialog are not created. This is to avoid a proliferation of unnecessary files. The stand-alone Dialogs can themselves have sub-Dialogs (embedded or linked) if required.

 

Click to view step-by-step instructions.

Create the master Dialog:

  1. Create a master Dialog in any convenient location. This is where the master Answer-sets will be stored. When you first create this Dialog, you need not add any fields - just leave the Dialog blank!

NOTE

The master Dialog can be in a different Application to that in which the stand-alone Dialogs are stored.

 

  1. Make sure the "Prompt to Save" property on all your stand-alone Dialogs is not selected.

 

That's all you need do in terms of Dialogs. On the template side you need the following:

  1. At the top of the template, insert the following script. This script executes only if the master Answer-set does not exist. It dynamically creates a new shell master Answer-set based on as many individual Dialogs (e.g.,"NameOfDialog1", "NameOfDialog2" etc.) as you require:

%[DeleteBlockIf(Dialogs.Exists('NameOfApplication\Master', MasterAnswerSetName))]

%[Master = Dialogs.New('NameOfApplication\Master', MasterAnswerSetName)]

%[Master.SetV('Dialog1',Dialogs.New('NameOfApplication\NameOfDialog1', MasterAnswerSetName))]

%[Master.SetV('Dialog2',Dialogs.New('NameOfApplication\NameOfDialog2', MasterAnswerSetName))]

%[Master.SetV('Dialog3',Dialogs.New('NameOfApplication\NameOfDialog3', MasterAnswerSetName))]

etc.

%[Dialogs.Save(Master, False)]

%[EndBlock()]

 

  1. Then you need to insert the following script, depending on which Dialog you want to pop up. For example, if in the template you want to load only "Dialog1":

 

%[Master = Dialogs.Select('My Application\Master', MasterAnswerSetName)]

%[Dialog1 = Master.Dialog1]

%[Dialogs.Edit(Dialogs1)]

The above script will load the master Answer-set containing only the fields from the specified Dialog.

 

%[Master.Dialog1 = Dialog1]

%[Dialogs.Save(Master, False)]

The above script will save any captured data back to the master.