Solved

Routing approval based on total

Posted on 2011-03-07
Medium Priority
552 Views
Have a basic tracer that I need to add a little bit of validation. Need to add an If Then to take into account a new field that I am using to get a line item total. (lenovo_total) Also I am going to have 3 vendor options now on the form. (vendor) So basically I need to use the code below if the vendor = "L" and the lenovo total is greater than \$500. This will route for approval on the order. If the order is less than \$500 it will not require finance approval so it would just be a similar tracer to the user that the order has been submitted and is processing.
What is the best way to evaluate for the vendor ("L", "D" or "HP") and also do the total check on the price. I will end up with 6 possibilities, one for each vendor and on if over the defined limit and one if under that limit.
FIELD status:="Pending Approval";
FIELD submit_flag:="done";
FIELD submit_date:=@Today;
SendTo := approver;
CopyTo := "";
BlindCopyTo := bcc;
Subject := "Equipment Order for " + username_hidden + " requires your approval";
Remark := "An IBPC Admin Equipment Order has been entered for " + username_hidden + ". Your approval is required. Please click on the following link and approve or reject the request.";
@MailSend(SendTo; CopyTo; BlindCopyTo; Subject; Remark; "";[IncludeDoclink]);
@PostedCommand([FileSave]);
@PostedCommand([FileCloseWindow])
0
Question by:jforget1

LVL 22

Accepted Solution

mbonaci earned 2000 total points
ID: 35063914
Use normal nested @If-s:

@If( 	vendor = "L";
@if( amount > 500;
@Do( series of functions for > 500 );
@Do( series of functions for < 500 )
);
vendor = "D";
@if( amount > 500;
@Do( series of functions for > 500 );
@Do( series of functions for < 500 )
);
vendor = "HP";
@if( amount > 500;
@Do( series of functions for > 500 );
@Do( series of functions for < 500 )
);
@Prompt([OK]; "Unknown vendor"; "Please choose the vendor")
)

If you need to set field values inside @Do, then instead of
FIELD status:="Pending Approval";
use
@SetField( "status"; "Pending Approval" )
0

Author Comment

ID: 35068858
Excellent this is exactly what I needed. Was having trouble with the syntax logic on this one. Thanks for the help as usual.
0

Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.