Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# Rules and Functions

If you are using the source editor, adapt these instructions that focus on the form-based editor and mention the equivalent settings in the source editor.

Figure 58: Rule Form Editor

Rule Source Editor

     * @description
     * @author
     */
    rule Rules.ProcessDebits.ApplyDebit {
      attribute {
        priority = 1;
        forwardChain = true;
    Optionally add entry for Rank as needed (Rank=RuleFunction), or enter in Form view.
      }
      declare {
        Events.Debit  debit;
        Concepts.Account  account;
      }
      when {
        //Checks whether the extId of an Account instance in working memory
        //matches the incoming event's account ID
        account@extId == debit.AccountId;
      }
      then {
        //If Account Status is not Suspended, debits the account
        if (account.Status !="Suspended") {
        account.Debits=debit.Amount;
        System.debugOut("############### Debiting account <" +account@extId+ "> by $" +debit.Amount);
        account.Balance=account.Balance - debit.Amount;
        System.debugOut("############### New balance: $" + account.Balance);
        }
        else {
        System.debugOut("############### Cannot debit the suspended acount <" +account@extId +">");
        }
        Event.consumeEvent(debit);
      }
    }

Subtopics

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.