private void OnInit(IInputProperty sender, SuccessEventArgs args) { this._inputReader = this.InputPointReader(this.Input.RecordInfo); if (this._inputReader == null) { args.Success = false; return; } this.Output?.Init( FieldDescription.CreateRecordInfo( this.Input.RecordInfo, new FieldDescription( this.ConfigObject.OutputBinXFieldName, FieldType.E_FT_Double, source: "HexBin: X Co-ordinate of Center"), new FieldDescription( this.ConfigObject.OutputBinYFieldName, FieldType.E_FT_Double, source: "HexBin: Y Co-ordinate of Center"))); this._outputBinXFieldBase = this.Output?[this.ConfigObject.OutputBinXFieldName]; this._outputBinYFieldBase = this.Output?[this.ConfigObject.OutputBinYFieldName]; args.Success = 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); }
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); }
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; }
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 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 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 void OnInit(IInputProperty sender, SuccessEventArgs args) { this._nextValue = this.CreateRandomFunc(); var fieldDescription = new FieldDescription( this.ConfigObject.OutputFieldName, this.ConfigObject.OutputType, source: $"RandomNumber: {this.ConfigObject.ToString().Replace($"{this.ConfigObject.OutputFieldName}=", string.Empty)}"); this.Output?.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, fieldDescription)); this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName]; args.Success = true; }
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); }
private bool InitFunc(RecordInfo info) { this._nextValue = this.ConfigObject.CreateRandomFunc(); var fieldDescription = this.ConfigObject.OutputType.OutputDescription(this.ConfigObject.OutputFieldName, 19); if (fieldDescription == null) { return(false); } fieldDescription.Source = nameof(RandomNumber); fieldDescription.Description = $"Random Number {this.ConfigObject.ToString().Replace($"{this.ConfigObject.OutputFieldName}=", "")}"; this.Output?.Init(FieldDescription.CreateRecordInfo(info, fieldDescription)); this._outputFieldBase = this.Output?[this.ConfigObject.OutputFieldName]; return(true); }
/// <summary> /// Called only if you have no Input Connections /// </summary> /// <param name="nRecordLimit"></param> /// <returns></returns> public override bool PI_PushAllRecords(long nRecordLimit) { if (!this._result.Success) { return(false); } if (this.Output == null) { this.Engine.OutputMessage( this.NToolId, MessageStatus.STATUS_Error, "Output is not set."); return(false); } var recordInfo = FieldDescription.CreateRecordInfo(this._descriptions.ToArray()); this.Output.Init(recordInfo); if (nRecordLimit == 0) { this.Output.Close(true); return(true); } var data = this._result.Execute.DynamicInvoke(); var recordOut = this.Output.Record; var asString = data as string; var asEnum = asString != null ? new[] { asString } : (data as IEnumerable) ?? new[] { data }; foreach (object sample in asEnum) { this.PushRecord(recordOut, this._descriptions, sample); } this.ExecutionComplete(); this.Output.Close(true); return(true); }
private bool InitFunc(RecordInfo info) { this._inputFieldBase = info.GetFieldByName(this.ConfigObject.InputFieldName, false); if (this._inputFieldBase == null) { return(false); } this.Output.Init( FieldDescription.CreateRecordInfo( info, new FieldDescription(this.ConfigObject.OutputFieldName, FieldType.E_FT_V_String) { Size = 256, Source = nameof(HashCodeGenerator) })); this._outputFieldBase = this.Output[this.ConfigObject.OutputFieldName]; this._hashAlgorithm = this.ConfigObject.GetAlgorithm(); return(true); }
private void OnInit(IInputProperty sender, SuccessEventArgs args) { this._inputFieldBase = this.Input.RecordInfo.GetFieldByName(this.ConfigObject.InputFieldName, false); if (this._inputFieldBase == null) { args.Success = false; return; } var field = new FieldDescription( this.ConfigObject.OutputFieldName, FieldType.E_FT_V_String, 256, source: nameof(HashCodeGeneratorEngine)); this.Output.Init(FieldDescription.CreateRecordInfo(this.Input.RecordInfo, field)); this._outputFieldBase = this.Output[this.ConfigObject.OutputFieldName]; this._hashAlgorithm = this.GetAlgorithm(); args.Success = true; }
/// <summary> /// The PI_PushAllRecords function pointed to by this property will be called by the Alteryx Engine when the plugin /// should provide all of it's data to the downstream tools. /// This is only pertinent to tools which have no upstream (input) connections (such as the Input tool). /// </summary> /// <param name="nRecordLimit"> /// The nRecordLimit parameter will be < 0 to indicate that there is no limit, 0 to indicate /// that the tool is being configured and no records should be sent, or > 0 to indicate that only the requested /// number of records should be sent. /// </param> /// <returns>Return true to indicate you successfully handled the request.</returns> public override bool PI_PushAllRecords(long nRecordLimit) { this.DebugMessage($"{nameof(nRecordLimit)} Called with {nameof(nRecordLimit)} = {nRecordLimit}"); this.Output.Init(FieldDescription.CreateRecordInfo( new FieldDescription("XPath", FieldType.E_FT_V_WString), new FieldDescription("InnerText", FieldType.E_FT_V_WString), new FieldDescription("InnerXml", FieldType.E_FT_V_WString))); if (nRecordLimit != 0) { var nodes = this.ReadNodes(); if (nodes == null) { return(false); } long recordCount = 0; foreach (var data in nodes) { this.Output.PushData(data); recordCount++; if (recordCount % 100 == 0) { this.Output.PushCountAndSize(); } if (nRecordLimit == recordCount) { break; } } } this.Output.PushCountAndSize(); this.Output.Close(true); return(true); }
private bool InitFunc(RecordInfo info) { this._inputReader = this.ConfigObject.InputPointReader(info); if (this._inputReader == null) { return(false); } this.Output?.Init(FieldDescription.CreateRecordInfo( info, new FieldDescription(this.ConfigObject.OutputBinXFieldName, FieldType.E_FT_Double) { Source = nameof(HexBin), Description = "X Co-ordinate of HexBin Centre" }, new FieldDescription(this.ConfigObject.OutputBinYFieldName, FieldType.E_FT_Double) { Source = nameof(HexBin), Description = "Y Co-ordinate of HexBin Centre" })); this._outputBinXFieldBase = this.Output?[this.ConfigObject.OutputBinXFieldName]; this._outputBinYFieldBase = this.Output?[this.ConfigObject.OutputBinYFieldName]; return(true); }
/// <summary> /// The PI_PushAllRecords function pointed to by this property will be called by the Alteryx Engine when the plugin /// should provide all of it's data to the downstream tools. /// This is only pertinent to tools which have no upstream (input) connections (such as the Input tool). /// </summary> /// <param name="nRecordLimit"> /// The nRecordLimit parameter will be < 0 to indicate that there is no limit, 0 to indicate /// that the tool is being configured and no records should be sent, or > 0 to indicate that only the requested /// number of records should be sent. /// </param> /// <returns>Return true to indicate you successfully handled the request.</returns> public override bool PI_PushAllRecords(long nRecordLimit) { if (this.Output == null) { this.Engine.OutputMessage(this.NToolId, MessageStatus.STATUS_Error, "Output is not set."); return(false); } var field = new FieldDescription( this.ConfigObject.OutputFieldName, this.ConfigObject.OutputType, 19, source: $"DateTImeInput: {this.ConfigObject.DateToReturn}"); var recordInfo = FieldDescription.CreateRecordInfo(field); this.Output.Init(recordInfo); if (nRecordLimit == 0) { this.Output.Close(true); return(true); } var dateOutput = ValueToReturn(this.ConfigObject.DateToReturn); var recordOut = this.Output.Record; this.Output[this.ConfigObject.OutputFieldName]?.SetFromString( recordOut, dateOutput.ToString( this.ConfigObject.OutputType == FieldType.E_FT_Time ? "HH:mm:ss" : "yyyy-MM-dd HH:mm:ss")); this.Output.Push(recordOut); this.Output.UpdateProgress(1.0); this.Output.Close(true); return(true); }
/// <summary> /// Called only if you have no Input Connections /// </summary> /// <param name="nRecordLimit"></param> /// <returns></returns> public override bool PI_PushAllRecords(long nRecordLimit) { if (this.Output == null) { this.Engine.OutputMessage( this.NToolId, AlteryxRecordInfoNet.MessageStatus.STATUS_Error, "Output is not set."); return(false); } var fieldDescription = this.ConfigObject.OutputType.OutputDescription(this.ConfigObject.OutputFieldName, 19); if (fieldDescription == null) { return(false); } fieldDescription.Source = nameof(DateTimeInput); fieldDescription.Description = $"{this.ConfigObject.DateToReturn}"; var recordInfo = FieldDescription.CreateRecordInfo(fieldDescription); this.Output.Init(recordInfo); if (nRecordLimit == 0) { this.Output.Close(true); return(true); } var dateOutput = DateTime.Today; switch (this.ConfigObject.DateToReturn) { case DateToReturn.Now: dateOutput = DateTime.Now; break; case DateToReturn.Yesterday: dateOutput = dateOutput.AddDays(-1); break; case DateToReturn.StartOfWeek: dateOutput = dateOutput.AddDays(-(int)dateOutput.DayOfWeek); break; case DateToReturn.StartOfMonth: dateOutput = dateOutput.AddDays(1 - dateOutput.Day); break; case DateToReturn.StartOfYear: dateOutput = new DateTime(dateOutput.Year, 1, 1); break; case DateToReturn.PreviousMonthEnd: dateOutput = dateOutput.AddDays(-dateOutput.Day); break; case DateToReturn.PreviousYearEnd: dateOutput = new DateTime(dateOutput.Year - 1, 12, 31); break; } var recordOut = this.Output.CreateRecord(); this.Output[this.ConfigObject.OutputFieldName]? .SetFromString(recordOut, dateOutput.ToString(this.ConfigObject.OutputType == OutputType.Time ? "HH:mm:ss" : "yyyy-MM-dd HH:mm:ss")); this.Output.Push(recordOut); this.Output.UpdateProgress(1.0); this.Output.Close(true); return(true); }