Exemplo n.º 1
0
        private void prep()
        {
            // Exit if already done (safety)
            if (_recordInfoOut != null)
            {
                return;
            }

            _recordInfoOut = new AlteryxRecordInfoNet.RecordInfo();

            populateRecordInfoOut();

            _recordCopier = new RecordCopier(_recordInfoOut, _recordInfoIn, true);

            uint countFields = _recordInfoIn.NumFields();

            for (int i = 0; i < countFields; ++i)
            {
                var fieldName = _recordInfoIn[i].GetFieldName();

                var newFieldNum = _recordInfoOut.GetFieldNum(fieldName, false);
                if (newFieldNum == -1)
                {
                    continue;
                }

                _recordCopier.Add(newFieldNum, i);
            }

            _recordCopier.DoneAdding();

            _outputHelper.Init(_recordInfoOut, "Output", null, _xmlProperties);
        }
Exemplo n.º 2
0
        public bool II_Init(RecordInfo recordInfo)
        {
            _incomingInfo = recordInfo;
            _info         = new RecordInfo();
            _copier       = new RecordCopier(_info, _incomingInfo, false);
            for (var index = 0; index < _incomingInfo.NumFields(); index++)
            {
                var field = _incomingInfo[index];
                if (field.FieldType != FieldType.E_FT_FixedDecimal)
                {
                    _info.AddField(field.GetFieldName(), field.FieldType, (int)field.Size, field.Scale, field.GetSource(), field.GetDescription());
                    _copier.Add(index, index);
                    continue;
                }

                var fieldType = FieldType.E_FT_Double;
                if (field.Scale == 0)
                {
                    fieldType = FieldType.E_FT_Int64;
                }
                _decimalMapping.Add(index, fieldType);
                _info.AddField(field.GetFieldName(), fieldType, 0, 0, field.GetSource(), field.GetDescription());
            }
            _copier.DoneAdding();
            _record = _info.CreateRecord();
            _parent.InitOutput(_info);
            return(true);
        }
        /// <summary>
        /// Creates a new instance of an <see cref="IRecordCopier"/>.
        /// </summary>
        /// <param name="info">The source <see cref="AlteryxRecordInfoNet.RecordInfo"/> object.</param>
        /// <param name="newRecordInfo">The target <see cref="AlteryxRecordInfoNet.RecordInfo"/> objects.</param>
        /// <param name="fieldsToSkip">A list of fields to skip.</param>
        /// <returns>A new instance of an <see cref="IRecordCopier"/> object.</returns>
        public IRecordCopier CreateCopier(RecordInfo info, RecordInfo newRecordInfo, params string[] fieldsToSkip)
        {
            var copier = new RecordCopier(newRecordInfo, info, true);

            for (int fieldNum = 0; fieldNum < info.NumFields(); fieldNum++)
            {
                string fieldName = info[fieldNum].GetFieldName();
                if (fieldsToSkip.Contains(fieldName))
                {
                    continue;
                }

                var newFieldNum = newRecordInfo.GetFieldNum(fieldName, false);
                if (newFieldNum == -1)
                {
                    continue;
                }

                copier.Add(newFieldNum, fieldNum);
            }

            copier.DoneAdding();
            return(new RecordCopierWrapper(copier));
        }
Exemplo n.º 4
0
        public bool II_Init(RecordInfo recordInfo)
        {
            _info         = new RecordInfo();
            _incomingInfo = recordInfo;
            _copier       = new RecordCopier(_info, _incomingInfo, false);
            for (var i = 0; i < _incomingInfo.NumFields(); i++)
            {
                _info.AddField(_incomingInfo[i]);
                _copier.Add(i, i);
            }
            _copier.DoneAdding();
            _info.AddField(_parent.NewField, FieldType.E_FT_Int64);
            _newField = _info.GetFieldByName(_parent.NewField, false);

            _fields = new FieldBase[_parent.Fields.Length];
            for (var i = 0; i < _fields.Length; i++)
            {
                _fields[i] = _incomingInfo.GetFieldByName(_parent.Fields[i], false);
            }

            _record = _info.CreateRecord();
            _parent.Output.Init(_info, "Output", null, _parent.Config);
            return(true);
        }
 public RecordCopierWrapper(RecordCopier parent)
 {
     this._parent = parent;
 }