0
votes

I have an editable dialog list that use for choices Use formula for choices. It uses a DbLookup on a view.

Is there any chance that if after the @DbLookup there are 3 values the first one to be set already as the default value for the dialog list?

Thanks for your time and help!

4

4 Answers

6
votes

First of all: To optinmize performance and minimize Lookups I would use a separate field for the lookup of the values (lets call it ValueList, it can be computed for Display, has to allow multiple value). Then as formula for your DialogBox just enter the name of the field ValueList And in the Default- Value formula of the Dialog- Field you enter:

@Subset( ValueList ; 1 );

if your ValueList looks like this:

SomeValue|1
AnotherValue|2

then the formula in the default value would look like:

@Word( @Subset( ValueList ; 1 ); "|" ; 2 )

If your lookup depends on another field in the form, and may change, then the Default- Value formula is NOT enough as it is only calculated once on the first document open of a new document. Then your Input Validation- Formula could look like:

@If( @IsMember( @ThisValue; ValueList ); @ThisValue; @Subset( ValueList ; 1 ) )

This would make sure, that if your lookup- formula changes and the current value is not in the list of possible changes anymore, that it again selects the first value from the (new) list...

of course all of this needs some "finetuning", but basically that should solve your Problem.

0
votes

You can use a default value formula for the default value of the field using your DBLookup. In that case the field value would be set and hence the value would be selected in the dialog, too. You can use @subset(@DbLookup(...);1)

0
votes

had a similar case and i used this solution with a @prompt and a ProfileDocument.

@Prompt([OkCancelList]:[NoSort]; Title; prompt;DefaultChoice;@GetProfileField( profilname ; fieldname));

The DefaultChoice must be a value from the Profile Document.

0
votes

This worked for me, in the dialog Form's PostOpen formula, set the Default Field values for your fields. eg. where FormerFirstName is another field on the dialog form.

@SetField( "Firstname"; FormerFirstName );