
Keyword fields (known to the younger audience as: Radio buttons, checkboxes, combobox, dropdowns etc.) very often are populated by @Formulas. @DBColumn, @DBLookup and @GetProfileField are equally popluar. For best performance you should use @GetProfileField (if that is possible in your application context). Another way to speed things up: prevent the formulas from executing in Read Mode. If for example a formula to populate the options looks like this:
tmp := @DBLookup("Notes":"NoCache";"";"(LookupProjectsBySponsor)";@UserName;2);
@if(@IsError(tmp);"You don't sponsor projects"; tmp)
change it to
@if(!@IsDocBeingEdited;@Return(@ThisValue);"");
tmp := @DBLookup("Notes":"NoCache";"";"(LookupProjectsBySponsor)";@UserName;2);
@if(@IsError(tmp);"You don't sponsor projects"; tmp)
You can refine that and not populate keywords you don't intend to change (based on a status), you would update the first condition then.
Comments
In any case, one "gotcha" with this technique is when a keyword field uses aliases. In those cases, the lookup is necessary to ensure the "user-friendly" non-alias value displays in read mode.
Posted by Kevin Pettitt At 23:09:10 On 12/03/2008 | - Website - |
@if(IsDocBeingEdited="0";@Return(@ThisValue);"");
tmp := @DBLookup("Notes":"NoCache";"";"(LookupProjectsBySponsor)";@UserName;2);
@if(@IsError(tmp);"You don't sponsor projects"; tmp)
This avoid @isdocbeingedited formula getting calculated every time.
Posted by P.V.Nagarajan At 20:23:40 On 12/10/2008 | - Website - |