Error when action is carried out on a form

Hello All,

I have created a form that has an action. The action checks that all the mandatory fields are filled in and then it send a mail to a user that is set in one of the fields.

I then want to change the value of two more fields when the mail is sent. and for the form to save and close

Here is my code:

@Command([FileSave]);

FIELD Status:=Status;

FIELD DateSentCSP:=DateSentCSP;

@If

(

ProsNewClientName = “”;@Prompt([Ok] ; “Error!” ; “You must enter a new client name!”):@Command([EditGotoField] ; “ProsNewClientName”) ;

Radio1=“”; @Prompt([Ok] ; “Error!” ; “You must enter a choice for Question 1 to continue”):@Command([EditGotoField] ; “Radio1”) ;

Radio2=“”; @Prompt([Ok] ; “Error!” ; “You must enter a choice for Question 1(a) to continue”):@Command([EditGotoField] ; “Radio2”) ;

Radio3=“”; @Prompt([Ok] ; “Error!” ; “You must enter a choice for Question 2 to continue”) :@Command([EditGotoField] ; “Radio3”) ;

Radio4=“”; @Prompt([Ok] ; “Error!” ; “You must enter a choice for Question 2(a) to continue”):@Command([EditGotoField] ; “Radio4”) ;

@MailSend(User;“”;“”;“Client Acceptance Form to be approved”;“”;"Can you please look at the following Client Acceptance form for approval and forward onto the Business Unit Leader for approval using the Mail Business Unit Leader Button >>> ";[Sign]:[IncludeDoclink]):

@SetField(“Status”;“Sent to CSP”):

@SetField(“DateSentCSP”;@Today):

@Command([FileSave]):@Command([CloseWindow]))

The Mail send works, the fields change and the window save and closes but I am still gettin and error that says

“Incorrect data type for operator or @Function: Number expected”

The Status field is a computed text field and the DateSentCSP is a editable date/time field

The status and the DateSentCSP fields change so it looks lie the code is working but then I still get the error. Any ideas?

Thanking you in advance,

Laura

Subject: Error when action is carried out on a form

hi laura,somewhere on the form there must be a field of type NUMBER. as I see, the code of the action should be ok.

try to open a new document with this form and then just save (STRG-S) ist. do you get the same error ? if so, there is a field of type NUMBER you do not fill with the correct data.

cheers

@lex

Subject: Error when action is carried out on a form

Hi Laura,

The main thing that jumped out at me looking at your formula is that you’ve got a bunch of colons separating commands at the end instead of semi-colons -

@MailSend(User;“”;“”;“Client Acceptance Form to be approved”;“”;"Can you please look at the following Client Acceptance form for approval and forward onto the Business Unit Leader for approval using the Mail Business Unit Leader Button >>> ";[Sign]:[IncludeDoclink]): @SetField(“Status”;“Sent to CSP”): @SetField(“DateSentCSP”;@Today): @Command([FileSave]):@Command([CloseWindow]))

Is this how it is in your action? I suspect that this could be something to do with your problem if it is.

Emily.

Subject: RE: Error when action is carried out on a form

Hi Emily,

Yes I have the colon in between in each one but when I use a semicolon on the first command is carried out and it stops. I only want the fields to be set if a mail is sent.

Laura

Subject: RE: Error when action is carried out on a form

Ahh - i see! I didn’t read your formula thoroughly enough. In that case, I think you need to put @Do round those statements, so the last parameter of your @If would be this:

@Do(@MailSend(User;“”;“”;“Client Acceptance Form to be approved”;“”;"Can you please look at the following Client Acceptance form for approval and forward onto the Business Unit Leader for approval using the Mail Business Unit Leader Button >>> ";[Sign]:[IncludeDoclink]);

@SetField(“Status”;“Sent to CSP”);

@SetField(“DateSentCSP”;@Today);

@Command([FileSave]);@Command([CloseWindow]))

As far as I know, you can only use the colon to build a list of values, you cant use it to build a list of commands to run in sequence.

Hope this helps!

Emily.

Subject: RE: Error when action is carried out on a form

That worked a treat thanks… Just a point though in the following code :

Radio3=“”; @Prompt([Ok] ; “Error!” ; “You must enter a choice for Question 2 to continue”) : @Command([EditGotoField] ; “Radio3”) ;

I have a colon seperating commands and not a semi colon… these all run with no errors. Maybe it is just chance or maybe you can have one command joined to another with a colon and that is it.

I should probably put an @Do around all of these too. When they didn’t give an error I thought you could do it …

Anyway thanks for your help on this

Subject: RE: Error when action is carried out on a form

Interesting - maybe there are some circumstances where this does work. I’m by no means an expert on this! Can anyone out there confirm whether you can join two or more commands with a colon rather than @Do?

Glad you got your code working, Laura!

Emily.