Read Calculation Flow database input
Reads rows from an InVision database to be processed sequentially in a Calculation Flow. If no Table or Parameter relationships are defined, all rows are processed.
Properties
Name | Type | Description |
---|---|---|
Row variable name | Required | The name of the variable that holds a reference to the row from the source table or query that is currently being processed. You don't need to change the default name, but best practices is to provide a meaningful name that makes it easier to understand what data the row represents. For example, if you are processing sales data, consider nameing the variable "salesLine". |
Connection | Required | A valid InVision Connection. |
Source table | Required | The table or view to read data from. |
Source columns | Optional | The columns to read from the Source table. If you don't specify anything, all columns are read from the source. Note this may add overhead if not all columns are needed, which will impact performance negatively. |
Table relationships | Optional | The Table relationship is used to slice the data set being processed. When a Calculation Flow is executed, the calling context (for example InVision) may pass in a Data Context which specifies the context of which the Flow is run. This is typically a selected filter item, for example a specific department or an account group, or a selection of items from multiple different filters. Under the hoods, the Table relationships along with the Data Context creates a SQL JOIN that defines the data being processed. If neither this nor the Parameter relationships property is defined, or the caller does not pass in a Data Context, all rows from the Source table is processed. |
Parameter relationships | Optional | Just like the Table relationship, the Parameter relationship is used to slice the data set being processed. The difference between the Table relationship and the Parameter relationship is that parameters are a set of standalone values that can be used to slice the data set being processed. Under the hoods, the Parameters relationships along with the Data Context creates a WHERE clause to slice the data being processed. If both Table and Parameter relationships are defined, and the Data Context contains data for both table and parameter contexts, both features are used to slice the data set being processed (SQL JOIN + WHERE clause). If neither Parameter nor the Table relationships are defined, or the caller does not pass in a Data Context, all rows from the Source table are processed. |
Custom data context | Optional | If the caller does not pass in a Data Context, you can create a Data Context programatically to slice the data set being processed. The example below demonstrates how to create a custom Data Context. |
Example
This example shows how to programatically create a custom Data Context for a Calculation Flow. The code is defined in a Function action.
// Creating our own DataContext to simulate that the call comes from InVision.
return new Profitbase.Flow.Extensions.Invision.CalculationFlow.CalculationFlowDataContext
{
ReferenceTableDataContexts = new List<Profitbase.Flow.Extensions.Invision.CalculationFlow.ReferenceTableDataContext>
{
new Profitbase.Flow.Extensions.Invision.CalculationFlow.ReferenceTableDataContext("Account", "AccountID", "3"),
new Profitbase.Flow.Extensions.Invision.CalculationFlow.ReferenceTableDataContext("Account", "AccountID", "4"),
new Profitbase.Flow.Extensions.Invision.CalculationFlow.ReferenceTableDataContext("Account", "AccountID", "5"),
new Profitbase.Flow.Extensions.Invision.CalculationFlow.ReferenceTableDataContext("Account", "AccountID", "6"),
new Profitbase.Flow.Extensions.Invision.CalculationFlow.ReferenceTableDataContext("Account", "AccountID", "7"),
new Profitbase.Flow.Extensions.Invision.CalculationFlow.ReferenceTableDataContext("Account", "AccountID", "8"),
},
Arguments = new List<Profitbase.Flow.Extensions.Invision.CalculationFlow.DataContextArgument>
{
new Profitbase.Flow.Extensions.Invision.CalculationFlow.DataContextArgument("OutputName", "CalcTax")
}
};