Help with @prompt

I am not able to get the 1, 0, or -1 of an @prompt ([YesNoCancel]…

Below is my code. I placed in an OK prompt to try to find out what “done” is returning.

If I put in a higher cost then I get “HI” as expected, but if I place in a lower cost, I get nothing regardless if I press Yes, No, or Cancel. What am I doing wrong???

Cost := @Prompt([OkCancelEdit];“Actual Scrap Cost”;“Enter the actual scrap cost.”;“”);

r1 := @SetField(“ScrapDollar”;@TextToNumber(Cost));

send := @MailSend(“Teri Colvin”;“”;“”;“PD_DB: Approval Requested”;"Please review and approve the following Parts Disposition for " + PartNo + “.”;“Thank You” + @NewLine + @NewLine;[IncludeDoclink]);

done := @If(@TextToNumber(Cost) < ScrapDollar_1; @Prompt([YesNoCancel];“Approval Not Needed”; “The actual cost is less then the approved estimate. You do not need to route for approval. Do you want to route this?”); “HI”);

@Prompt([OK];“check of done”;done);

@if(done = 1 ; r1 ; r1+ send);

TIA

Teri

Subject: Help with @prompt

Giving the code a quick glance, it looks like you are being inconsistent with text and number data types. Specifically, the variable “done” evaluates to a number if true and text if false. Theoretically this shouldn’t matter but you never know.

You also make reference to a field called “ScrapDollar” and another called “ScrapDollar_1”, which may be a typo, not sure.

HTH

Subject: RE: Help with @prompt

Kevin,

I just placed HI in there to see what was going on otherwise I had 0. The OK Prompt showed me that if the < condition was met the prompt shows nothing. If the < condition is not met, then it shows “HI”.

As for the ScrapDollar and ScrapDollar_1 those are two fields on my form.

Any other suggestions???

Teri

Subject: Help with @prompt

you can’t code like that. regardless of what done is returning your SetField and MailSend will both evaluate and get processed. this is because the temp variables evaluate from top to bottom. So, the ScrapDollar field is getting set and MailSend is getting kicked off no matter what your done IF statement evaluates to.

But to answer your question try:

@Prompt([OK];“check of done”; @Text(done))

Subject: RE: Help with @prompt

OK,

Now I am lost. What part of designer help should I re-read to come up with what I want?

What I want to do is:

IF x< Y

Then @promptONe

Otherwise @promptTwo

If @promptOne = 1

then do something

if @promptOne = 0

then do something else

If @promptTwo = 1

then do something different

and so on and so on and so on.

I have never had to try to write something this complicated so I am thrown for a loop. This is found in a hotspot to help the user through the decision process.

TIA

Teri

Subject: RE: Help with @prompt

Well it looks like you want to set the ScrapDollar field regardless so something like this should work:

REM “Prompt the user for the cost”;

Cost := @Prompt([OkCancelEdit]; “Actual Scrap Cost”;“Enter the actual scrap cost.”;“”);

REM “Set the ScrapDollar field regardless”;

@SetField(“ScrapDollar”;@TextToNumber(Cost));

REM “If the cost entered is less than the value in ScrapDollar_1 then ask the user if they want to route for approval”;

ask := @If(@TextToNumber(Cost) < ScrapDollar_1; @Prompt([YesNoCancel];“Approval Not Needed”; “The actual cost is less then the approved estimate. You do not need to route for approval. Do you want to route this?”); “”);

REM “If the user cancels or answers no then abort, otherwise do the MailSend”;

@If(ask != 1; @Return(“”); “”);

REM “If we get here then user answered YES”;

@MailSend(“Teri Colvin”;“”;“”;“PD_DB: Approval Requested”;"Please review and approve the following Parts Disposition for " + PartNo + “.”;“Thank You” + @NewLine + @NewLine;[IncludeDoclink])

Subject: RE: Help with @prompt

Paul, your a peach,

That works.

I added in another Prompt statement and luckily it needs to have the same results if it is 1. So it works fine.

The *** around the code is not in the actual code. It is only what I placed in instead of having “” :

ask := @If(@TextToNumber(Cost) < ScrapDollar_1; @Prompt([YesNoCancel];“Approval Not Needed”; “The actual cost is less then the approved estimate. You do not need to route for approval. Do you want to route this?”);

@Prompt([YesNoCancel];“Approval Needed”;“Actual is more then estimate, do you want to send a request now?”));

REM “If the user cancels or answers no then abort, otherwise do the MailSend”;

@If(ask != 1 ;@Return(“”) ; “” );

One more question though. If the second prompt that I placed in would need a different mail send (which it should) then how would I put that variable in?

I hope this is clear.

Hmm … Maybe putting in the @if comparison of dollars for the mail send??

Thanks

Teri

Subject: RE: Help with @prompt

something like below should work:. you mentioned the second mailsend would be different but I just left it the same and you can make your changes.

Cost := @Prompt([OkCancelEdit]; “Actual Scrap Cost”;“Enter the actual scrap cost.”;“”);

@SetField(“ScrapDollar”;@TextToNumber(Cost));

ask1 := @If(@TextToNumber(Cost) < ScrapDollar_1; @Prompt([YesNoCancel];“Approval Not Needed”; “The actual cost is less then the approved estimate. You do not need to route for approval. Do you want to route this?”); “”);

ask2 := @If(@TextToNumber(Cost) >= ScrapDollar_1; @Prompt([YesNoCancel];“Approval Needed”; “Actual is more then estimate, do you want to send a request now?”); “”);

@If(ask1 != 1; “”; @MailSend(“Teri Colvin”;“”;“”;“PD_DB: Approval Requested”;"Please review and approve the following Parts Disposition for " + PartNo + “.”;“Thank You” + @NewLine + @NewLine;[IncludeDoclink]));

@If(ask2 != 1; “”; @MailSend(“Teri Colvin”;“”;“”;“PD_DB: Approval Requested”;"Please review and approve the following Parts Disposition for " + PartNo + “.”;“Thank You” + @NewLine + @NewLine;[IncludeDoclink]))