How to..user @Prompt and computed field for local copy

Hi,I am trying to use a magical @prompt so that for offline users, a dialogue box appears where they can enter an email address.

This is because; for online users this field will be computed by looking up to the Corporate Name & Address Book.

I am trying to evaluate this by working out if there’s an error in the field (this is a COMPUTED field btw). If theres an error, then the user should get the dialogue box once enter the details, which should set the field.

BUT - what is happening at the moment is, it all seems to work fine, until you enter something in the next field. Then the prompt re-appears - and asks you to input the same info again…I just want it there once…

Any ideas???

Heres the code:-

  1. SalesRep field. This is just a editable dialoguebox containing a keyword lookup to a list of names in the database;

  2. Computed field called SPemail

Heres the code:-

ukpin := @Right(@DbLookup(“”:“”;“85255F7E:006405B0”;“($Users)”;@Name([CN];SalesRep);7);8);

InternetEmailAddresscomp := @DbLookup(“”:“”;“86256395:004EDFB0”;“(PeopleByPin)”;ukpin;“InternetAddress”);

@If(@IsError(InternetEmailAddresscomp) & SalesRep!=“”);

Result:=@Prompt([OkCancelEdit];“Please enter the Sales Persons internet email address.”; “For example this address should end @companyname.com”;"@companyname.com");

@If(SalesRep=“”;“”;

@If(@IsError(InternetEmailAddresscomp) & SalesRep=“”); Result;InternetEmailAddresscomp)))

Subject: How to…user @Prompt and computed field for local copy…

As you have it, the prompt will appear every time the document is refreshed, as the code is in a computed field - so it is recomputed whenever the document is refreshed.

You could put this code in one of the form events - probably postopen or postrefresh, and change your SPemail field to computed when composed with “” as the default value.

Your code in the event would then have to check if the field has already been set, and if not set the value of the field:

rem “If the SPemail field already has a value, exit”;

@if(SPemail<>“”;@return(0);“”);

ukpin := @Right(@DbLookup(“”:“”;“85255F7E:006405B0”;“($Users)”;@Name([CN];SalesRep);7);8);

InternetEmailAddresscomp := @DbLookup(“”:“”;“86256395:004EDFB0”;“(PeopleByPin)”;ukpin;“InternetAddress”);

@If(@IsError(InternetEmailAddresscomp) & SalesRep!=“”);

Result:=@Prompt([OkCancelEdit];“Please enter the Sales Persons internet email address.”; “For example this address should end @companyname.com”;"@companyname.com");

FIELD SPemail := @If(SalesRep=“”;“”;

@If(@IsError(InternetEmailAddresscomp) & SalesRep=“”); Result;InternetEmailAddresscomp)))