Fabric Project functions are user-defined Java functions that are added to the project implementation to perform complex data manipulations or to execute queries on a specific Instance ID.
Functions can be edited in the Fabric Studio by opening the function’s code from the Project Tree.
Functions can be created in Logical Units, References, Web Services, Shared Objects or from existing Table Populations (using an LuFunction Actor).
To create a new function, either open an existing Logic.java file under the Logical Unit or click on Logical Units > [LU Name] > Java > right click on src > New Java Logic File (when you want to create a new Category).
The Web Studio provides a snippet syntax helper: type Ctrl+Space and then type fabric for Fabric snippets. For functions you can type FF. This will show you several function types. Once you have selected a function, the syntax helper will offer you the syntax along with some options.
For example, selecting fabric-function-trigger will provide the following function template:
@desc("")
@type(TriggerFunction)
public static void functionName(TableDataChange tableDataChange) throws Exception {
}
The Function Manager window displays the following panes on the right of the window:
Both panes include the following components:
To define Input and Output settings manually, do the following:
The Bulk Load Parameters option can be used to upload multiple parameters to a function.
Input / Output settings can be automatically defined based on DB objects either from a source DB or LU objects using the Objects / Database pane in the Function Manager window.
Example of the code generated for the function with Input = CUSTOMER_ID from the CUSTOMER table:
String sql = "SELECT CUSTOMER_ID FROM CUSTOMER";
db("CRM_DB").fetch(sql, <val1>, <val2>, ...).each(row->{
});
Notes
Click to display the Fabric API list: http://[Fabric IP address]:3213/static/doc/user-api/index.html
To invoke a project function from another category in the same LU, do the following to add an import:
To see the import, open the source file of the function's category. For example, when adding an invocation to the fnCheckSourceEnv() function which belongs to the DECISION category in the CRM Logical Unit, the following import is added:
import static com.k2view.cdbms.usercode.lu.CRM.DECISION.Logic.fnCheckSourceEnv;
To invoke several functions in the same category, modify the import as follows:
import static com.k2view.cdbms.usercode.lu.CRM.DECISION.Logic.*;
Fabric Project functions are user-defined Java functions that are added to the project implementation to perform complex data manipulations or to execute queries on a specific Instance ID.
Functions can be edited in the Fabric Studio by opening the function’s code from the Project Tree.
Functions can be created in Logical Units, References, Web Services, Shared Objects or from existing Table Populations (using an LuFunction Actor).
To create a new function, either open an existing Logic.java file under the Logical Unit or click on Logical Units > [LU Name] > Java > right click on src > New Java Logic File (when you want to create a new Category).
The Web Studio provides a snippet syntax helper: type Ctrl+Space and then type fabric for Fabric snippets. For functions you can type FF. This will show you several function types. Once you have selected a function, the syntax helper will offer you the syntax along with some options.
For example, selecting fabric-function-trigger will provide the following function template:
@desc("")
@type(TriggerFunction)
public static void functionName(TableDataChange tableDataChange) throws Exception {
}
The Function Manager window displays the following panes on the right of the window:
Both panes include the following components:
To define Input and Output settings manually, do the following:
The Bulk Load Parameters option can be used to upload multiple parameters to a function.
Input / Output settings can be automatically defined based on DB objects either from a source DB or LU objects using the Objects / Database pane in the Function Manager window.
Example of the code generated for the function with Input = CUSTOMER_ID from the CUSTOMER table:
String sql = "SELECT CUSTOMER_ID FROM CUSTOMER";
db("CRM_DB").fetch(sql, <val1>, <val2>, ...).each(row->{
});
Notes
Click to display the Fabric API list: http://[Fabric IP address]:3213/static/doc/user-api/index.html
To invoke a project function from another category in the same LU, do the following to add an import:
To see the import, open the source file of the function's category. For example, when adding an invocation to the fnCheckSourceEnv() function which belongs to the DECISION category in the CRM Logical Unit, the following import is added:
import static com.k2view.cdbms.usercode.lu.CRM.DECISION.Logic.fnCheckSourceEnv;
To invoke several functions in the same category, modify the import as follows:
import static com.k2view.cdbms.usercode.lu.CRM.DECISION.Logic.*;