Example #1
0
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            var fieldDescription = new FieldDescription(
                this.ConfigObject.OutputFieldName,
                this.ConfigObject.OutputType,
                source: $"NumberParser: {this.ConfigObject.InputFieldName} parsed as a number");

            this._inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false);
            if (this._inputFieldBase == null)
            {
                args.Success = false;
                return;
            }

            this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription));
            this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName];

            // Create the Copier
            this._copier = this.RecordCopierFactory.CreateCopier(
                this.Input.RecordInfo,
                this.Output?.RecordInfo,
                this.ConfigObject.OutputFieldName);

            args.Success = true;
        }
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            // Get Input Field
            this._inputField = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false);
            if (this._inputField == null)
            {
                args.Success = false;
                return;
            }

            // Create Output Format
            this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo,
                                                                new FieldDescription(nameof(XmlUtils.NodeData.XPath), FieldType.E_FT_V_WString),
                                                                new FieldDescription(nameof(XmlUtils.NodeData.InnerText), FieldType.E_FT_V_WString),
                                                                new FieldDescription(nameof(XmlUtils.NodeData.InnerXml), FieldType.E_FT_V_WString)));

            // Create the Copier
            this._copier = this.RecordCopierFactory.CreateCopier(
                this.Input.RecordInfo,
                this.Output?.RecordInfo,
                nameof(XmlUtils.NodeData.XPath),
                nameof(XmlUtils.NodeData.InnerText),
                nameof(XmlUtils.NodeData.InnerXml));

            this._xpathField     = this.Output?[nameof(XmlUtils.NodeData.XPath)];
            this._innerTextField = this.Output?[nameof(XmlUtils.NodeData.InnerText)];
            this._innerXmlField  = this.Output?[nameof(XmlUtils.NodeData.InnerXml)];

            args.Success = true;
        }
Example #3
0
            private bool InitFunc(RecordInfo info)
            {
                this._inputFieldBase = info.GetFieldByName(this.ConfigObject.jsonField, false);
                if (this._inputFieldBase == null)
                {
                    return(false);
                }

                var fd = new FieldDescription("jsonAsCSV", FieldType.E_FT_V_WString)
                {
                    Size        = Int16.MaxValue,
                    Source      = nameof(jsonParser),
                    Description = $"{this.ConfigObject.jsonField} parsed as CSV"
                };

                this.Output?.Init(FieldDescription.CreateRecordInfo(info, fd));
                this._outputFieldBase = this.Output?["jsonAsCSV"];

                // Create the Copier
                this._copier = this.RecordCopierFactory.CreateCopier(info, this.Output?.RecordInfo);

                this._data = new List <string>();

                return(true);
            }
Example #4
0
            private bool InitFunc(RecordInfo info)
            {
                var fieldDescription = this.ConfigObject?.OutputType.OutputDescription(this.ConfigObject.OutputFieldName, 19);

                if (fieldDescription == null)
                {
                    return(false);
                }
                fieldDescription.Source      = nameof(NumberParser);
                fieldDescription.Description = $"{this.ConfigObject.InputFieldName} parsed as a number";


                this._inputFieldBase = info.GetFieldByName(this.ConfigObject.InputFieldName, false);
                if (this._inputFieldBase == null)
                {
                    return(false);
                }

                this.Output?.Init(FieldDescription.CreateRecordInfo(info, fieldDescription));
                this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName];

                // Create the Copier
                this._copier = this.RecordCopierFactory.CreateCopier(info, this.Output?.RecordInfo, this.ConfigObject.OutputFieldName);

                return(true);
            }
            private bool InitFunc(RecordInfo info)
            {
                // Get Input Field
                var inputFieldBase = info.GetFieldByName(this.ConfigObject.InputFieldName, false);

                if (inputFieldBase == null)
                {
                    return(false);
                }

                // Create Output Format
                var fieldDescription = new FieldDescription(this.ConfigObject.OutputFieldName, FieldType.E_FT_V_WString)
                {
                    Size = this.ConfigObject.OutputFieldLength, Source = nameof(StringFormatter)
                };

                this.Output?.Init(FieldDescription.CreateRecordInfo(info, fieldDescription));
                this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName];

                // Create the Copier
                this._copier = this.RecordCopierFactory.CreateCopier(info, this.Output?.RecordInfo, this.ConfigObject.OutputFieldName);

                // Create the Formatter function
                this._formatter = this.ConfigObject.CreateFormatter(inputFieldBase);

                return(this._formatter != null);
            }
Example #6
0
        private void OnInit(IInputProperty sender, SuccessEventArgs args)
        {
            // Get Input Field
            var inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false);

            if (inputFieldBase == null)
            {
                args.Success = false;
                return;
            }

            // Create Output Format
            var fieldDescription = new FieldDescription(
                this.ConfigObject.OutputFieldName,
                FieldType.E_FT_V_WString,
                this.ConfigObject.OutputFieldLength,
                source: nameof(StringFormatterEngine));

            this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription));
            this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName];

            // Create the Copier
            this._copier = this.RecordCopierFactory.CreateCopier(
                this.Input.RecordInfo,
                this.Output?.RecordInfo,
                this.ConfigObject.OutputFieldName);

            // Create the Formatter function
            this._formatter = this.CreateFormatter(inputFieldBase);

            args.Success = this._formatter != null;
        }
            private bool InitFunc(RecordInfo info)
            {
                this._inputFieldBase = info.GetFieldByName(this.ConfigObject.SortField, false);
                if (this._inputFieldBase == null)
                {
                    return(false);
                }

                this.Output?.Init(FieldDescription.CreateRecordInfo(info));

                // Create the Copier
                this._copier = this.RecordCopierFactory.CreateCopier(info, this.Output?.RecordInfo);

                this._data = new List <Tuple <string, Record> >();

                return(true);
            }