• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

Order of Operations

Someone please look at the code below and tell me how I can adjust it so that the agent "Checkduplot" runs before the rest of the code is executed.  Thanks.

@If(@IsDocBeingEdited ; ""; @Do(@Command([EditDocument])));

FIELD createdby := @Name([CN];@Author);
FIELD createdby_1 := @Name([CN];@Author);

FIELD batch := @UpperCase(@Prompt([OKCANCELEDIT];"Enter the Batch/ Lot Number";"Enter BATCH/ LOT NUMBER now.";""));
FIELD prodnum := @UpperCase(@Prompt([OKCANCELEDIT];"Enter the Product Number/ IPL Code";"Enter PRODUCT/ IPL NUMBER now.";""));
FIELD startdate := @If(startdate = "";@Prompt([OKCANCELEDIT];"Enter the Batch Card Start Date";"Enter BATCH CARD START DATE now using the below format.                                                   xx/xx/xxxx";"");startdate);

FIELD prodname :=@If(prodnum = "";"";@SetField("prodname";@DbLookup( "" : "NoCache" ;"85256AF1:00576E26";"Dup View" ; prodnum ;4 )));

@If(prodname = "";@Do(@Prompt([OK];"Check Product Number";"Product Number/ IPL Code not in master list.  Please type in the Product Name as it appears on the Batch Card.");@Command([EditGotoField] ; "prodname" ));"");
@If(prodname = "**DELETED**";@Do(@Prompt([OK];"Check Batch Card";"Product Number/ IPL Code has been deleted.  Please type in the Product Name as it appears on the Batch Card.");@SetField("prodtext";"show");@SetField("prodname_1";""));"");

FIELD bstatus := "Product Filled";
FIELD prodtext := "show";
FIELD card := "show";
FIELD button := "show";
FIELD bodycount := 1;

  • 2
1 Solution
Hi schmad01,
If you're using version 6 or later, instead of

use @Function
    @Command( [RunAgent] ; agent )

and it'll be executed where it's put in the code.

Hope this helps,
schmad01Author Commented:
No, at this time we are running 5.0.11.
Well, I assume that  you want to check for a value, and if found, then don't execute the rest of the code?

If so, then is @Command([ToolsRunMacro];"Checkduplot") << written in LS or Formula?

IF formula, then you have to figure a way to pass a value from that agent to your current one.

At top of your code:

Best is to clear an environment value:

@SetEnvironment( "checkdup";"");
Rem "then call your second agent";


>>Checkduplot : This agent needs to write an "FAIL"  or "SUCCESS" to the checkdup environment if it finds a duplicate, etc.<<

REm "Then when that agent ends, it will roll back to the calling agent."

@if(@Environment("CheckDup") = "FAIL"; @Return("");"");

Now you can continue with the rest of your code.
schmad01Author Commented:
Beautiful, thank you!

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now