Exemplo n.º 1
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);
            });
        }
Exemplo n.º 2
0
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            // Inputs
            var inputArray    = InputArray.Get(context);
            var searchWordCol = SearchWord.Get(context);
            var displayLog    = DisplayLog;

            //Convert Collection to Array
            string[] searchWord = Utils.ConvertCollectionToArray(searchWordCol);
            ///////////////////////////
            // Add execution logic HERE
            bool bIsFound = Utils.MatchItemInArrayOfStrings(inputArray, searchWord, displayLog);

            ///////////////////////////

            // Outputs
            return((ctx) => {
                IsFound.Set(ctx, bIsFound);
            });
        }