Inputs and outputs

Use the Table Name field to specify a single table as an input, or select the Advanced Input/Output button to open the Inputs and Outputs subtable where you can specify multiple inputs and outputs for your logic block. Inputs and outputs can be either:

  • Records—A record within a table that holds multiple values. Records are represented in a logic block as a data source name (DSN). For example, if you need to compare data between multiple fields in a record, you would specify the name of the table which holds the record.
  • Values—A value that only contains one piece of information. Values are represented in a logic block as a variable. For example, if you need to perform calculations on the value held in the Cost field of an application, you would specify the Cost data item as a Value input and output. This would allow the logic block action to pull in the value held in that field, perform calculations on it, then pass it back to the application. 

Logic blocks which use multiple inputs and outputs can only be called from other logic blocks. If the logic block is called by an application, only a single table can be passed to the logic block when it is initiated. The table must be marked as both an input and output, and it must be compatible with the table which the application is built over. This scenario may occur if you are using the same logic block in multiple places. 

For example, you could have a logic block with the following configured in the Inputs and Outputs subtable: 

TypeShapeInputsOutputs
RecordSales Order Detailxx
RecordSales Order Headerx
ValueCostxx

If this logic block was called by an application, only the Sales Order Detail record could be passed to the logic block since it was marked as both an input and an output, and because applications cannot specify a data item. 

If this logic block was called by another logic block, all of the inputs and outputs specified would be available as inputs and outputs in the Call a Logic Block action of the other logic block.

Additional data sources

Optionally, you can designate additional data sources, such as tables or other logic blocks, in logic block actions. Many logic block actions have a Data Source Name (DSN) field which can be used to reference outputs of data that the logic block creates. For example, if you use the Call a Logic Block action to pass a record to a processing logic block, then that logic block updates the record and passes it back to the calling logic block, the updated record information can then be used in other logic block actions by referencing the DSN from the calling logic block. 

Learn more in Logic block data source development considerations.


Logic block lists

Logic block lists enable you to provide a list of either records or variables (values) to be used within your logic blocks. Lists are created in the Inputs and Outputs subtable of your logic block record, or with the Create List action. 

To create a list in the Inputs and Outputs subtable, select the Is List checkbox on the appropriate row. The shape of the list entries is dictated by the Input/output shape specified on the row. 

There are several logic block actions used with lists, including:

  • Create List action—Create a list. 
  • Size of List action—Acquire an accurate record count from your list. 
  • Set Values action—Add, clear, remove, or set entries. Learn more in Set Values action
  • Loop List action—Loop through the list entries. Learn more in Loop List action

Once a list has been created, it is treated like any other input or output on the logic block. This allows it to be passed between, iterated on, and referenced by other logic blocks without the limitations of temp table records. 

Comparing temp tables to logic block lists

Lists functionally behave the same as temp tables. However, lists provide more clarity during the development process on how and where the list of records or values can be used and referenced.

The table below compares temp tables and input and output lists: 

Temp TableInput and Output List
Created in the Create a Temp Table logic block action. Created by selecting the Is List checkbox on an entry in the Inputs and Outputs subtable, or with the Create List action. 
Can only contain records. The shape of the records is determined by the table selected during configuration. Can contain either records or variables (values). The shape of the list entries is determined by the shape selected in the input and output row. 
Entries are added to a temp table with the Insert Record action.  You can reference the list in a Set Values action and add, set, clear, or remove entries. 
Limited to 15,000 records. Record lists are limited to 15,000 records. Value lists are limited to 50,000 records.
Do not support indexes, and cannot be fetched by any filter criteria. Entries within a list are considered data sources and cannot be indexed or filtered.  
Uses the Fetch Temp Table action to retrieve records. Uses the Loop List action to retrieve records.
Shared temp tables can only be accessed within the same transaction boundary. Lists may be passed between transaction boundaries. 
Temp tables can be used in background type logic blocks, but have limitations due to the transaction boundary limitations. Record lists can be created, but not passed to background type logic blocks.
You can create an HD Structure of type temp using a temp table in the Create HD Structure action. 
For more information on NATE considerations, see the Create HD Structure action.
You cannot use lists to create an HD Structure. 

Learn more in Create a Temp Table action and Logic block inputs and outputs.

Logic block values

Logic block values are objects, such as fields, constants, and variables, that can be manipulated within a logic block's actions.

The values which the logic block can access and manipulate are provided by the data sources specified in the Inputs and Outputs subtable, data sources in logic blocks being called by your logic block, or from system defined values. Learn more in Logic block inputs and outputs.

Values

There are several types of values that can be used in logic block actions, as seen in the table below. 

Value type
Description
Field

A field that the logic block has access to from the inputs and outputs defined in the logic block, or module setting attached to the underlying application. 

Constant

A user defined value, such as a number or text, that is only valid for input values. Constants are defined within logic block actions. 

Variable

A user or system defined value that is not found in an application. Variables are temporary values that can be reused throughout the logic block once they are defined, but are not saved to the table or application record. Once defined, you can also reference a variable within another logic block's Inputs and Outputs. 

For example, you could define a New Variable, select the Data Type of Date, then select a System Value of Today. The value of Today would then be available for use in your logic block actions. 

If you copy logic block actions that use variables into another logic block, you must:

  • Update the values and names of the variables. 
  • Also copy the action that defines the variable, or redefine the variable in the logic block. 
  • Add the variable name to the action in the destination logic block if you copy both the action using the variable and the action defining the variable. 
System

Common values that Nextworld provides. These are available for most, but not all, data types.

Table

The entire record of a table. Use this this type when fetching a series of records that you want to process as a group in a single transaction.


Logic block expressions

Logic block actions use expressions to identify the records in a table which the logic block action applies to. 

Expressions are configured in the properties of logic block actions. You can add multiple expressions to an action, and then organize them to dictate the order in which the action should be applied. 

Logic block actions use operators to control how the action uses expressions. There are two operators, And and Or.

If you use And to connect your expressions, the action only acts on records that satisfy all the expressions. If you use Or to connect your expressions, the action acts on records that satisfy any of the expressions.

For example, you can use expressions to identify records with a payment of $100 And a remaining balance greater than or equal to $50. You could also use expressions to identify records with a payment of $100 Or a remaining balance greater than or equal to $50. 

Field to field comparisons

You can also use logic block expressions to do a field to field comparison. For example, you could use expressions to fetch records where the value in the Debit Amount field is greater than the value in the Credit Amount field. To accomplish this, you would create an expression with: 

Type: FieldGreater Than >Type: Field
Table: FetchedTableExample
Table: FetchedTableExample
Field: DebitAmount
Field: CreditAmount
Data Type: Currency
Data Type: Currency

External expressions

External expressions are defined elsewhere, then referenced in your logic block action for use. For example, you might want your logic block to only fetch the records which match the filter criteria within the application. To achieve this, you would use the Received Filter expression. 

There are different types of external expressions, including:

  • Dynamic—Expressions created with the Build Dynamic Expression or Build Dynamic Sort actions which enables you to create reusable filter or sort definitions. You can modify existing dynamic expressions by selecting Existing for your expression type in the Build Dynamic Expression action, then referencing the name of the previously configured expression. You can use the AND or OR operators to add to the existing filter. If you don't reference the existing expression in your filter, it is overwritten.
  • Received Filter—Expressions created by the platform based on the filter criteria defined in the application. Received filters can only be used on the table in which they were defined. 
  • Received Selection—Expressions that enable you to filter for all records selected on the application when the logic block is called. 
  • Inline Filter—Expressions created with the Inline Filter data item type which enable you to pass a record to a logic block and use the filter criteria saved in the record to filter fetched data. Learn more in Data item types.

To use external expressions, select the Add External Expression button in logic block fetch actions.

Logic block data source development considerations

This topic reviews development considerations for logic block inputs and outputs. 

Outputs

If outputs are assigned to a new object, it creates a new Variable or DSN. If outputs are assigned to an existing object, it overwrites the existing variable, field, or DSN.

Header Details

If you specify a Header Detail table as a logic block input or output record, the data source stores information about the Header and HD Structure. To include the Detail records, you must either fetch each Detail table's records or specify them as additional inputs and outputs. 

If a called logic block updates both a Header and Detail from within an HD Structure, the calling logic block must reference the Header output and re-fetch the Detail records to ensure current versions. If the Detail record is specified as both an input and output, you can inherit changes made to that data source instead of re-fetching to create a second and third copy. Outputs prevent HD maintenance within a logic block and improve performance. 

NATE

Inputs and outputs behavior does not change with NATE turned on or off in a logic block. 

Deprecation

Inputs and outputs configured in the Inputs and Outputs subtable cannot be deleted once a logic block has been delivered. Use the Deprecate checkbox to indicate the value or record is deprecated and add a new row to the subtable. 

Currency in logic blocks

Currency fields can be used in multiple ways within logic blocks. This topic explains how and where currency fields are configured and stored, as well as what currency-specific system values can be used.

Currency fields

Currency fields are stored as objects that consist of two attributes, the amount field and the code field. These two parts make up the field value. For example, if the value of the TransactionAmount field is 12.00 USD, 12.00 is the amount, and USD is the code.

In the Currency Attribute field of your logic block actions, select an attribute to dictate how the field can be used, or leave the field blank to use the entire value. 

Use the value attribute in math actions, use the code attribute to set or use the currency code, and use the amount attribute to reference the numerical subcomponent. There is limited support for currencies missing a code. For example, you cannot compare currencies without a populated code. 

ZeroCurrency

Use the ZeroCurrency system value to set the value of a currency field or variable to zero. When you set a field to ZeroCurrency, you must also set the currency code in the same action. ZeroCurrency is considered the amount of the field, but the field also needs a code. You can do math with a ZeroCurrency field and can also compare currency fields to ZeroCurrency instead of 0.00 USD. 

For example, if you want to validate if a field value is greater than zero, you would configure your expression to, if TransactionAmount > greater than ZeroCurrency. 

CurrencyConfig

The CurrencyConfig table is used to manage the different currencies available for transactions. This table is fetched in logic blocks to ensure the currency codes used are valid. In other words, instead of hard-coding currency codes that could later be invalid, you fetch the values from a table.

Currency variables and extended precision

A currency variable is sometimes used in place of a currency data item in a logic block and can inherit characteristics of a currency data item, including decimal and extended precision used in calculations. Nextworld can store and use the extended precision in calculations. 

For a currency variable in a logic block, you must define the Table and As variable attributes to use any extended precision inherited from a currency data item. The currency variable must have access to the applicable logic block table prior to setting the Table and As variable attributes. If you do not want to use extended precision for a currency variable, do not define the Table and As variable attributes. 

For more information about extended precision, see Extended precision. 

Currency math

This topic reviews the rules for currency math actions in logic blocks.

There are several rules to consider, such as:

  • All inputs must have the same currency code. The only exceptions are the use of NULL codes as shown in the table below. 
  • You must have an amount set before you select a currency code. 
  • At least one of the inputs in the equation must have an amount and a code.
  • You should never hard-code currency values.
  • Outputs inherit the currency code of inputs.

The table below shows different scenarios for adding or subtracting currency fields, and what the results are with different input combinations.

Input
Input
Output
ValueCode
ValueCode
ValueCodeComments
5.0USD+ or -
10.0USD=15.0USDBoth inputs have a currency code and non NULL amount. 
5.0USD+ or -
10.0CAD=ERROR
Inputs have different codes. 
5.0USD+ or -
NULLUSD=ERROR
Currency field has a NULL amount with a currency code. 
5.0USD+ or -
10.0NULL=ERROR
The second input has a currency amount, but no currency code.
5.0 USD+ or -
0.0NULL=5.00USDThe second input is zero, and has no currency code. 
5.0USD+ or -
NULLNULL=5.00USDThe second input is treated as zero, even though it has no currency code.
5.0NULL+ or -
10.0NULL=ERROR
One currency code must be defined.