Use of temporary variable in @prompt!

I want a different prompt to appear for each different mainprojectphase, when the users press’s a button.

Depending on what status the document is in, different things get blanked out when you use an update action…

So, I created the code, like this one:

FIELD Version:=Version;

FIELD UNID:=UNID;

FIELD MainProjectPhase:=MainProjectPhase;

FIELD Status:=Status;

tempvarforresult:=

@If(MainProjectPhase=“Requirements Gathering”;“Requirements Gathering”;

@If(MainProjectPhase=“SOX Impact”;

“Requirements Gathering”:“SOX Impact”;

@If(MainProjectPhase=“QA and Test Plans”;

“Requirements Gathering”:“SOX Impact”:“QA and Test Plans”;

@If(MainProjectPhase=“Testing”;

“Requirements Gathering”:“SOX Impact”:“QA and Test Plans”:“Testing”;

@If(MainProjectPhase=“Go Live”;

“Requirements Gathering”:“SOX Impact”:“QA and Test Plans”:“Testing”:“Go Live”;

“”;“”;“”)))));

result:=@Prompt([YesNoCancel]; “Are you sure?”; “Updating the Requirements will require the the following project phase’s to be reapproved: " + @Char(13) + tempvarforresult +”.");

But, the prompt is only ever bringing up ‘Requirements Gathering’…never anything else…

I created a test form with just two fields ‘MainProjectPhase’ and computed field based on the code above…it works then, e.g. depending what you select, the computed field is set to the right value???

Subject: Use of temporary variable in @prompt! -FORGET IT1

FORGET IT, JUST NEED @IMPLODE FOR SOME REASON!

Subject: RE: Use of temporary variable in @prompt! -FORGET IT1

Hi

You needed to @implode because you’re setting the variable to an array when using “value1”:“value2”, whereas @prompt wants a string.

If you want the values on a separate line why not set the variable to “value1” + @Char(13) + “value” etc., as you use in the prompt function already.

Also, why use all those nested @ifs? You can clean your code up a lot by removing them all:

empvarforresult:=

@If(MainProjectPhase=“Requirements Gathering”;“Requirements Gathering”;

@If(MainProjectPhase=“SOX Impact”;

“Requirements Gathering” + @char(13) + “SOX Impact”;

MainProjectPhase=“QA and Test Plans”;

“Requirements Gathering” + @Char(13) + “SOX Impact” + @Char(13) + “QA and Test Plans”;

MainProjectPhase=“Testing”;

“Requirements Gathering” + @Char(13) + “SOX Impact” + + @Char(13) + “QA and Test Plans” + + @Char(13) + “Testing”;

MainProjectPhase=“Go Live”;

“Requirements Gathering” + @Char(13) + “SOX Impact” + @Char(13) + “QA and Test Plans” + @Char(13) + “Testing” + @Char(13) + “Go Live”;

“”);

result:=@Prompt([YesNoCancel]; “Are you sure?”; “Updating the Requirements will require the the following project phase’s to be reapproved: " + @Char(13) + tempvarforresult +”.");

Just my 2 pence worth

Dan