Implementation of dynamic call section in app Engine

Source: Internet
Author: User

In the operating mechanism of the app engine, the default is to start with the main section, according to the internal step arrangement, from the top down. This mechanism can satisfy most of our work, but in the face of more complex logic, sequential execution will appear a little pale, then we can in Peoplecode according to our logical requirements, dynamic call section to meet our logic.

In our app engine, there are a couple of sections, in main section, add if else logic, that is, if you have a bank account, you pay by cheque (called Giro_chk section), otherwise you will be paid by check (call Cxp_ CHK section) of the way.

First, add the Ae_section and Ae_applid fields in the state record of the application engine, and in your logic, assign the section ID you want to call to Ae_section. If the section you want to invoke is in the same application engine, you do not need to specify Ae_applid, or you assign the app engine you want to invoke to Ae_applid. As shown in the following illustration:

In Step2 's Peoplecode, add the following code

&Count_SQL = CreateSQL("SELECT COUNT(REMIT_BANK_ACCOUNT) FROM PS_PAYMENT_TBL WHERE PAY_CYCLE = :1 AND RTRIM(REMIT_BANK_ACCOUNT) = ''", DBS_TRANS_AET.PAY_CYCLE);
If &Count_SQL.Fetch(&SQL_Rows) Then
    If &SQL_Rows > 0 Then
       DBS_TRANS_AET.AE_SECTION = "CXP_CHK";
    Else
       DBS_TRANS_AET.AE_SECTION = "GIRO_CHK"
    End-If;
End-If;
&Count_SQL.Close();

If the number of rows returned is zero, as shown in the code, the Cxp_chk is assigned to Ae_section, else giro_chk.

After you complete this step, just add a method that dynamically invokes the section, as shown in the figure above. Sets the ProgramID to current (currently), and the dynamic is selected so that when the program is run to this step, the value stored by the current ae_section is invoked.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.