protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Object Container: Use objectContainer.Get<T>() to retrieve objects from the scope
            var objectContainer = context.GetFromContext <IObjectContainer>(TextApplicationScope.ParentContainerPropertyTag);

            // Inputs
            string inputText = objectContainer.Get <string>();

            // Inputs
            var anchorTextCol       = AnchorText.Get(context);
            var displayLog          = DisplayLog;
            var displayRegex        = DisplayRegex;
            var anchorTextParamText = AnchorTextParam.Get(context);

            //Convert Collection to Array
            string[] anchorText = Utils.ConvertCollectionToArray(anchorTextCol);

            //Output Data Row
            bool bUpdateDataRow  = BUpdateDataRow;
            var  myDataRow       = MyDataRow.Get(context);
            var  myDataRowColumn = MyDataRowColumn.Get(context);
            var  myIndex         = MyIndex.Get(context);

            string OutputString = null;

            ///////////////////////////
            // Add execution logic HERE
            string[] OutputResults = CallExtractions.CallExtractAllLinesBelowAnchorText(inputText, anchorText, anchorTextParamText, displayLog, displayRegex);

            #region Update Data Row (optional)
            //Check if functionality is Activated
            if (bUpdateDataRow == true)
            {
                //Check it there is an item to the Output Variable
                if (OutputResults.Length > 0)
                {
                    if (myIndex == -1)
                    {
                        //Upper Bound
                        OutputString = OutputResults[OutputResults.Length - 1];
                    }
                    else
                    {
                        OutputString = OutputResults[myIndex];
                    }

                    //Update Data Row
                    Utils.CallUpdateDataRow2(myDataRow, myDataRowColumn, OutputString);
                }
            }
            #endregion
            ///////////////////////////
            // Outputs
            return((ctx) =>
            {
                Results.Set(ctx, OutputResults);
            });
        }
Exemplo n.º 2
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var filterWordsCol  = FilterWords.Get(context);
            var displayLog      = DisplayLog;
            var anchorWordsText = AnchorWordsParameters.Get(context);
            var inputArray      = InputArray.Get(context);

            //Convert Collection to Array
            string[] filterWords = Utils.ConvertCollectionToArray(filterWordsCol);

            //Output Data Row
            bool bUpdateDataRow  = BUpdateDataRow;
            var  myDataRow       = MyDataRow.Get(context);
            var  myDataRowColumn = MyDataRowColumn.Get(context);
            var  myIndex         = MyIndex.Get(context);

            string OutputString = null;

            ///////////////////////////
            // Add execution logic HERE
            string[] OutputResults = CallExtractions.CallFindArrayItems(inputArray, filterWords, anchorWordsText, displayLog);

            #region Update Data Row (optional)
            //Check if functionality is Activated
            if (bUpdateDataRow == true)
            {
                //Check it there is an item to the Output Variable
                if (OutputResults.Length > 0)
                {
                    if (myIndex == -1)
                    {
                        //Upper Bound
                        OutputString = OutputResults[OutputResults.Length - 1];
                    }
                    else
                    {
                        OutputString = OutputResults[myIndex];
                    }

                    //Update Data Row
                    Utils.CallUpdateDataRow2(myDataRow, myDataRowColumn, OutputString);
                }
            }
            #endregion
            ///////////////////////////

            // Outputs
            return((ctx) => {
                Results.Set(ctx, OutputResults);
            });
        }