/// <summary>
        /// Generates the wizard data list from defs.
        /// </summary>
        /// <param name="definitions">The definitions.</param>
        /// <param name="defType">Type of the def.</param>
        /// <param name="pushToServer">if set to <c>true</c> [push to server].</param>
        /// <param name="errors">The errors.</param>
        /// <param name="withData"></param>
        /// <returns></returns>
        public StringBuilder GenerateWizardDataListFromDefs(string definitions, enDev2ArgumentType defType, bool pushToServer, out ErrorResultTO errors, bool withData = false)
        {
            IList <IDev2Definition> defs;
            IList <IDev2Definition> wizdefs = new List <IDev2Definition>();

            if (defType == enDev2ArgumentType.Output)
            {
                defs = OutputParser.ParseAndAllowBlanks(definitions);

                foreach (IDev2Definition def in defs)
                {
                    wizdefs.Add(def.IsRecordSet ? DataListFactory.CreateDefinition(def.RecordSetName + GlobalConstants.RecordsetJoinChar + def.Name, def.MapsTo, def.Value, def.IsEvaluated, def.DefaultValue, def.IsRequired, def.RawValue) : DataListFactory.CreateDefinition(def.Name, def.MapsTo, def.Value, def.IsEvaluated, def.DefaultValue, def.IsRequired, def.RawValue));
                }
            }
            else if (defType == enDev2ArgumentType.Input)
            {
                defs = InputParser.Parse(definitions);
                foreach (IDev2Definition def in defs)
                {
                    wizdefs.Add(def.IsRecordSet ? DataListFactory.CreateDefinition(def.RecordSetName + GlobalConstants.RecordsetJoinChar + def.Name, def.MapsTo, def.Value, def.IsEvaluated, def.DefaultValue, def.IsRequired, def.RawValue) : DataListFactory.CreateDefinition(def.Name, def.MapsTo, def.Value, def.IsEvaluated, def.DefaultValue, def.IsRequired, def.RawValue));
                }
            }

            return(GenerateDataListFromDefs(wizdefs, pushToServer, out errors, withData));
        }
Beispiel #2
0
        public static string GenerateMapping(IList <IDev2Definition> defs, enDev2ArgumentType typeOf)
        {
            DefinitionBuilder b = new DefinitionBuilder {
                ArgumentType = typeOf, Definitions = defs
            };

            return(b.Generate());
        }
        /// <summary>
        /// Generates the data list from defs.
        /// </summary>
        /// <param name="definitions">The definitions.</param>
        /// <param name="defType">Type of the def.</param>
        /// <param name="pushToServer">if set to <c>true</c> [push to server].</param>
        /// <param name="errors">The errors.</param>
        /// <returns></returns>
        public StringBuilder GenerateDataListFromDefs(string definitions, enDev2ArgumentType defType, bool pushToServer, out ErrorResultTO errors)
        {
            IList <IDev2Definition> defs = new List <IDev2Definition>();

            if (defType == enDev2ArgumentType.Output)
            {
                defs = OutputParser.ParseAndAllowBlanks(definitions);
            }
            else if (defType == enDev2ArgumentType.Input)
            {
                defs = InputParser.Parse(definitions);
            }

            return(GenerateDataListFromDefs(defs, pushToServer, out errors));
        }
        /// <summary>
        /// Shapes the dev2 definitions to data list.
        /// </summary>
        /// <param name="definitions">The definitions as string</param>
        /// <param name="defType">Type of the def.</param>
        /// <param name="pushToServer">if set to <c>true</c> [push to server].</param>
        /// <param name="errors">The errors.</param>
        /// <param name="flipGeneration">if set to <c>true</c> [flip generation].</param>
        /// <returns></returns>
        public StringBuilder ShapeDev2DefinitionsToDataList(string definitions, enDev2ArgumentType defType, bool pushToServer, out ErrorResultTO errors, bool flipGeneration = false)
        {
            var           dataList = ShapeDefinitionsToDataList(definitions, defType, out errors, flipGeneration);
            StringBuilder result;

            if (pushToServer)
            {
                //  Push to server and return GUID
                byte[] data = new byte[0];
                result = new StringBuilder(_svrCompiler.ConvertTo(null, DataListFormat.CreateFormat(GlobalConstants._XML), data, dataList, out errors).ToString());
            }
            else
            {
                result = dataList; // else return the datalist as requested
            }

            return(result);
        }
 /// <summary>
 /// Create a DL shape as per IO mapping
 /// </summary>
 /// <param name="arguments">The arguments.</param>
 /// <param name="typeOf">The type of.</param>
 /// <param name="errors">The errors.</param>
 /// <param name="flipGeneration">if set to <c>true</c> [flip generation].</param>
 /// <returns></returns>
 private StringBuilder ShapeDefinitionsToDataList(string arguments, enDev2ArgumentType typeOf, out ErrorResultTO errors, bool flipGeneration = false)
 {
     return(DataListUtil.ShapeDefinitionsToDataList(arguments, typeOf, out errors, flipGeneration));
 }
        public static string GenerateMapping(IList<IDev2Definition> defs, enDev2ArgumentType typeOf)
        {
            DefinitionBuilder b = new DefinitionBuilder { ArgumentType = typeOf, Definitions = defs };

            return b.Generate();
        }
        public List<IDebugItemResult> CreateDebugItemsFromString(string expression, string value, Guid dlId, int iterationNumber, string labelText, enDev2ArgumentType argumentType)
        {
            ErrorResultTO errors;
            IList<IDebugItemResult> resultsToPush = new List<IDebugItemResult>();
            IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
            IBinaryDataList dataList = compiler.FetchBinaryDataList(dlId, out errors);
            if(DataListUtil.IsValueRecordset(expression))
            {
                enRecordsetIndexType recsetIndexType = DataListUtil.GetRecordsetIndexType(expression);
                string recsetName = DataListUtil.ExtractRecordsetNameFromValue(expression);
                IBinaryDataListEntry currentRecset;
                string error;
                dataList.TryGetEntry(recsetName, out currentRecset, out error);

                if(recsetIndexType == enRecordsetIndexType.Star)
                {
                    if(currentRecset != null)
                    {
                        resultsToPush = CreateRecordsetDebugItems(expression, currentRecset, value, iterationNumber, labelText);
                        if(resultsToPush.Count < 2)
                        {
                            resultsToPush[0].GroupName = "";
                        }
                    }
                }
                else if(recsetIndexType == enRecordsetIndexType.Blank)
                {
                    int recsetIndexToUse = 1;

                    if(currentRecset != null)
                    {
                        if(argumentType == enDev2ArgumentType.Input)
                        {
                            if(!currentRecset.IsEmpty())
                            {
                                recsetIndexToUse = currentRecset.FetchAppendRecordsetIndex() - 1;
                            }
                        }
                        else if(argumentType == enDev2ArgumentType.Output)
                        {
                            if(!currentRecset.IsEmpty())
                            {
                                recsetIndexToUse = currentRecset.FetchAppendRecordsetIndex() - 1;
                            }
                        }
                    }
                    recsetIndexToUse = recsetIndexToUse + iterationNumber;
                    expression = expression.Replace("().", string.Concat("(", recsetIndexToUse, ")."));
                    resultsToPush = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, currentRecset, dlId, argumentType) : CreateScalarDebugItems(expression, value, labelText);
                }
                else
                {
                    resultsToPush = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, currentRecset, dlId, argumentType, labelText) : CreateScalarDebugItems(expression, value, labelText);
                }
            }
            else
            {
                IBinaryDataListEntry binaryDataListEntry;
                string error;
                dataList.TryGetEntry(expression, out binaryDataListEntry, out error);
                resultsToPush = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, binaryDataListEntry, dlId, argumentType, labelText) : CreateScalarDebugItems(expression, value, labelText);
            }

            return resultsToPush.ToList();
        }
 /// <summary>
 /// Shapes the definitions in binary form to create/amended a DL.
 /// </summary>
 /// <param name="curDlid">The cur DL ID.</param>
 /// <param name="typeOf">The type of.</param>
 /// <param name="definitions">The definitions.</param>
 /// <param name="errors"></param>
 /// <returns></returns>
 public Guid Shape(Guid curDlid, enDev2ArgumentType typeOf, IList <IDev2Definition> definitions, out ErrorResultTO errors)
 {
     return(_svrCompiler.Shape(null, curDlid, typeOf, definitions, out errors));
 }
        public List <IDebugItemResult> CreateDebugItemsFromEntry(string expression, IBinaryDataListEntry dlEntry, Guid dlId, enDev2ArgumentType argumentType, string labelText, int indexToUse = -1)
        {
            var results = new List <IDebugItemResult>();
            IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
            IBinaryDataList   dataList = compiler.FetchBinaryDataList(dlId, out ErrorsTo);

            if (
                !(expression.Contains(GlobalConstants.CalculateTextConvertPrefix) &&
                  expression.Contains(GlobalConstants.CalculateTextConvertSuffix)))
            {
                if (!expression.ContainsSafe("[["))
                {
                    results.Add(new DebugItemResult
                    {
                        Label = labelText,
                        Type  = DebugItemResultType.Value,
                        Value = expression
                    });
                    return(results);
                }
            }
            else
            {
                expression =
                    expression.Replace(GlobalConstants.CalculateTextConvertPrefix, string.Empty)
                    .Replace(GlobalConstants.CalculateTextConvertSuffix, string.Empty);
            }

            if (dlEntry != null && dlEntry.ComplexExpressionAuditor == null)
            {
                int groupIndex = 0;
                enRecordsetIndexType rsType = DataListUtil.GetRecordsetIndexType(expression);

                if (dlEntry.IsRecordset &&
                    (DataListUtil.IsValueRecordset(expression) &&
                     (rsType == enRecordsetIndexType.Star ||
                      (rsType == enRecordsetIndexType.Numeric &&
                       DataListUtil.ExtractFieldNameFromValue(expression) == string.Empty) ||
                      (rsType == enRecordsetIndexType.Blank &&
                       DataListUtil.ExtractFieldNameFromValue(expression) == string.Empty))))
                {
                    // Added IsEmpty check for Bug 9263 ;)
                    if (!dlEntry.IsEmpty())
                    {
                        IList <IDebugItemResult> collection = CreateRecordsetDebugItems(expression, dlEntry, string.Empty,
                                                                                        -1, labelText);
                        if (collection.Count < 2 && collection.Count > 0)
                        {
                            collection[0].GroupName = "";
                        }
                        results.AddRange(collection);
                    }
                    else
                    {
                        results.Add(new DebugItemResult
                        {
                            Type     = DebugItemResultType.Variable,
                            Label    = labelText,
                            Variable = expression,
                            Operator = string.IsNullOrEmpty(expression) ? "" : "=",
                            Value    = "",
                        });
                    }
                }
                else
                {
                    if (DataListUtil.IsValueRecordset(expression) &&
                        (DataListUtil.GetRecordsetIndexType(expression) == enRecordsetIndexType.Blank))
                    {
                        if (indexToUse == -1)
                        {
                            IBinaryDataListEntry tmpEntry;
                            string error;
                            dataList.TryGetEntry(DataListUtil.ExtractRecordsetNameFromValue(expression),
                                                 out tmpEntry, out error);
                            if (tmpEntry != null)
                            {
                                int index = tmpEntry.FetchAppendRecordsetIndex() - 1;
                                if (index > 0)
                                {
                                    groupIndex = index;
                                    expression = expression.Replace("().", string.Concat("(", index, ")."));
                                }
                            }
                        }
                        else
                        {
                            expression = expression.Replace("().", string.Concat("(", indexToUse, ")."));
                        }
                    }

                    if (dlEntry.IsRecordset)
                    {
                        var strIndx = DataListUtil.ExtractIndexRegionFromRecordset(expression);
                        int indx;
                        if (int.TryParse(strIndx, out indx))
                        {
                            if (indx > 0)
                            {
                                IBinaryDataListItem item = dlEntry.FetchScalar();
                                try
                                {
                                    CreateScalarDebugItems(expression, item.TheValue, labelText, results, "", groupIndex);
                                }
                                catch (NullValueInVariableException)
                                {
                                    CreateScalarDebugItems(expression, "", labelText, results, "", groupIndex);
                                }
                            }
                            else
                            {
                                CreateScalarDebugItems(expression, "", labelText, results, "", groupIndex);
                            }
                        }
                        else
                        {
                            IBinaryDataListItem itemx = dlEntry.FetchScalar();

                            if (!string.IsNullOrEmpty(strIndx))
                            {
                                IBinaryDataListEntry indexBinaryEntry;
                                IBinaryDataListItem  indexItem = null;
                                string error;
                                if (DataListUtil.IsValueRecordset(strIndx))
                                {
                                    dataList.TryGetEntry(DataListUtil.ExtractRecordsetNameFromValue(strIndx),
                                                         out indexBinaryEntry, out error);
                                    var fieldName = DataListUtil.ExtractFieldNameFromValue(strIndx);
                                    int index;
                                    if (int.TryParse(DataListUtil.ExtractIndexRegionFromRecordset(strIndx), out index))
                                    {
                                        indexItem = indexBinaryEntry.TryFetchRecordsetColumnAtIndex(fieldName, index, out error);
                                    }
                                }
                                else
                                {
                                    dataList.TryGetEntry(strIndx, out indexBinaryEntry, out error);
                                    indexItem = indexBinaryEntry.FetchScalar();
                                }
                                if (indexItem != null)
                                {
                                    expression = expression.Replace(string.Format("({0})", strIndx), string.Format("({0})", indexItem.TheValue));
                                }
                            }

                            try
                            {
                                CreateScalarDebugItems(expression, itemx.TheValue, labelText, results, "", groupIndex);
                            }
// ReSharper disable EmptyGeneralCatchClause
                            catch (Exception)
// ReSharper restore EmptyGeneralCatchClause
                            {
                            }
                        }
                    }
                    else
                    {
                        IBinaryDataListItem item = dlEntry.FetchScalar();
                        try
                        {
                            CreateScalarDebugItems(expression, item.TheValue, labelText, results, "", groupIndex);
                        }
                        catch (Exception)
                        {
                            CreateScalarDebugItems(expression, null, labelText, results, "", groupIndex);
                        }
                    }
                }
            }
            else
            {
                // Complex expressions are handled differently ;)
                if (dlEntry != null)
                {
                    ComplexExpressionAuditor auditor = dlEntry.ComplexExpressionAuditor;

                    int idx = 1;

                    foreach (ComplexExpressionAuditItem item in auditor.FetchAuditItems())
                    {
                        int    grpIdx            = idx;
                        string groupName         = item.RawExpression;
                        string displayExpression = item.RawExpression;
                        if (displayExpression.Contains("()."))
                        {
                            displayExpression = displayExpression.Replace("().",
                                                                          string.Concat("(", auditor.GetMaxIndex(), ")."));
                        }
                        if (displayExpression.Contains("(*)."))
                        {
                            displayExpression = displayExpression.Replace("(*).", string.Concat("(", idx, ")."));
                        }

                        results.Add(new DebugItemResult
                        {
                            Type       = DebugItemResultType.Variable,
                            Label      = labelText,
                            Variable   = displayExpression,
                            Operator   = string.IsNullOrEmpty(displayExpression) ? "" : "=",
                            GroupName  = groupName,
                            Value      = item.BoundValue,
                            GroupIndex = grpIdx
                        });

                        idx++;
                    }
                }
            }

            return(results);
        }
 public List <IDebugItemResult> CreateDebugItemsFromEntry(string expression, IBinaryDataListEntry dlEntry, Guid dlId, enDev2ArgumentType argumentType, int indexToUse = -1)
 {
     return(CreateDebugItemsFromEntry(expression, dlEntry, dlId, argumentType, "", indexToUse));
 }
        public List <IDebugItemResult> CreateDebugItemsFromString(string expression, string value, Guid dlId, int iterationNumber, string labelText, enDev2ArgumentType argumentType)
        {
            ErrorResultTO            errors;
            IList <IDebugItemResult> resultsToPush = new List <IDebugItemResult>();
            IDataListCompiler        compiler      = DataListFactory.CreateDataListCompiler();
            IBinaryDataList          dataList      = compiler.FetchBinaryDataList(dlId, out errors);

            if (DataListUtil.IsValueRecordset(expression))
            {
                enRecordsetIndexType recsetIndexType = DataListUtil.GetRecordsetIndexType(expression);
                string recsetName = DataListUtil.ExtractRecordsetNameFromValue(expression);
                IBinaryDataListEntry currentRecset;
                string error;
                dataList.TryGetEntry(recsetName, out currentRecset, out error);

                if (recsetIndexType == enRecordsetIndexType.Star)
                {
                    if (currentRecset != null)
                    {
                        resultsToPush = CreateRecordsetDebugItems(expression, currentRecset, value, iterationNumber, labelText);
                        if (resultsToPush.Count < 2)
                        {
                            resultsToPush[0].GroupName = "";
                        }
                    }
                }
                else if (recsetIndexType == enRecordsetIndexType.Blank)
                {
                    int recsetIndexToUse = 1;

                    if (currentRecset != null)
                    {
                        if (argumentType == enDev2ArgumentType.Input)
                        {
                            if (!currentRecset.IsEmpty())
                            {
                                recsetIndexToUse = currentRecset.FetchAppendRecordsetIndex() - 1;
                            }
                        }
                        else if (argumentType == enDev2ArgumentType.Output)
                        {
                            if (!currentRecset.IsEmpty())
                            {
                                recsetIndexToUse = currentRecset.FetchAppendRecordsetIndex() - 1;
                            }
                        }
                    }
                    recsetIndexToUse = recsetIndexToUse + iterationNumber;
                    expression       = expression.Replace("().", string.Concat("(", recsetIndexToUse, ")."));
                    resultsToPush    = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, currentRecset, dlId, argumentType) : CreateScalarDebugItems(expression, value, labelText);
                }
                else
                {
                    resultsToPush = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, currentRecset, dlId, argumentType, labelText) : CreateScalarDebugItems(expression, value, labelText);
                }
            }
            else
            {
                IBinaryDataListEntry binaryDataListEntry;
                string error;
                dataList.TryGetEntry(expression, out binaryDataListEntry, out error);
                resultsToPush = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, binaryDataListEntry, dlId, argumentType, labelText) : CreateScalarDebugItems(expression, value, labelText);
            }

            return(resultsToPush.ToList());
        }
 public List <IDebugItemResult> CreateDebugItemsFromString(string expression, string value, Guid dlId, int iterationNumber, enDev2ArgumentType argumentType)
 {
     return(CreateDebugItemsFromString(expression, value, dlId, iterationNumber, "", argumentType));
 }
        public List<IDebugItemResult> CreateDebugItemsFromEntry(string expression, IBinaryDataListEntry dlEntry, Guid dlId, enDev2ArgumentType argumentType, string labelText, int indexToUse = -1)
        {
            var results = new List<IDebugItemResult>();
            IDataListCompiler compiler = DataListFactory.CreateDataListCompiler();
            IBinaryDataList dataList = compiler.FetchBinaryDataList(dlId, out ErrorsTo);

            if(
                !(expression.Contains(GlobalConstants.CalculateTextConvertPrefix) &&
                  expression.Contains(GlobalConstants.CalculateTextConvertSuffix)))
            {
                if(!expression.ContainsSafe("[["))
                {
                    results.Add(new DebugItemResult
                        {
                            Label = labelText,
                            Type = DebugItemResultType.Value,
                            Value = expression
                        });
                    return results;
                }
            }
            else
            {
                expression =
                    expression.Replace(GlobalConstants.CalculateTextConvertPrefix, string.Empty)
                              .Replace(GlobalConstants.CalculateTextConvertSuffix, string.Empty);
            }

            if(dlEntry != null && dlEntry.ComplexExpressionAuditor == null)
            {
                int groupIndex = 0;
                enRecordsetIndexType rsType = DataListUtil.GetRecordsetIndexType(expression);

                if(dlEntry.IsRecordset &&
                    (DataListUtil.IsValueRecordset(expression) &&
                     (rsType == enRecordsetIndexType.Star ||
                      (rsType == enRecordsetIndexType.Numeric &&
                       DataListUtil.ExtractFieldNameFromValue(expression) == string.Empty) ||
                      (rsType == enRecordsetIndexType.Blank &&
                       DataListUtil.ExtractFieldNameFromValue(expression) == string.Empty))))
                {
                    // Added IsEmpty check for Bug 9263 ;)
                    if(!dlEntry.IsEmpty())
                    {
                        IList<IDebugItemResult> collection = CreateRecordsetDebugItems(expression, dlEntry, string.Empty,
                                                                                      -1, labelText);
                        if(collection.Count < 2 && collection.Count > 0)
                        {
                            collection[0].GroupName = "";
                        }
                        results.AddRange(collection);
                    }
                    else
                    {
                        results.Add(new DebugItemResult
                            {
                                Type = DebugItemResultType.Variable,
                                Label = labelText,
                                Variable = expression,
                                Operator = string.IsNullOrEmpty(expression) ? "" : "=",
                                Value = "",
                            });
                    }
                }
                else
                {
                    if(DataListUtil.IsValueRecordset(expression) &&
                        (DataListUtil.GetRecordsetIndexType(expression) == enRecordsetIndexType.Blank))
                    {
                        if(indexToUse == -1)
                        {
                            IBinaryDataListEntry tmpEntry;
                            string error;
                            dataList.TryGetEntry(DataListUtil.ExtractRecordsetNameFromValue(expression),
                                                 out tmpEntry, out error);
                            if(tmpEntry != null)
                            {
                                int index = tmpEntry.FetchAppendRecordsetIndex() - 1;
                                if(index > 0)
                                {
                                    groupIndex = index;
                                    expression = expression.Replace("().", string.Concat("(", index, ")."));
                                }
                            }
                        }
                        else
                        {
                            expression = expression.Replace("().", string.Concat("(", indexToUse, ")."));
                        }
                    }

                    if(dlEntry.IsRecordset)
                    {
                        var strIndx = DataListUtil.ExtractIndexRegionFromRecordset(expression);
                        int indx;
                        if(int.TryParse(strIndx, out indx))
                        {
                            if(indx > 0)
                            {
                                IBinaryDataListItem item = dlEntry.FetchScalar();
                                try
                                {
                                    CreateScalarDebugItems(expression, item.TheValue, labelText, results, "", groupIndex);
                                }
                                catch(NullValueInVariableException)
                                {
                                    CreateScalarDebugItems(expression, "", labelText, results, "", groupIndex);
                                }
                            }
                            else
                            {
                                CreateScalarDebugItems(expression, "", labelText, results, "", groupIndex);
                            }
                        }
                        else
                        {
                            IBinaryDataListItem itemx = dlEntry.FetchScalar();

                            if(!string.IsNullOrEmpty(strIndx))
                            {
                                IBinaryDataListEntry indexBinaryEntry;
                                IBinaryDataListItem indexItem = null;
                                string error;
                                if(DataListUtil.IsValueRecordset(strIndx))
                                {
                                    dataList.TryGetEntry(DataListUtil.ExtractRecordsetNameFromValue(strIndx),
                                                 out indexBinaryEntry, out error);
                                    var fieldName = DataListUtil.ExtractFieldNameFromValue(strIndx);
                                    int index;
                                    if(int.TryParse(DataListUtil.ExtractIndexRegionFromRecordset(strIndx), out index))
                                    {
                                        indexItem = indexBinaryEntry.TryFetchRecordsetColumnAtIndex(fieldName, index, out error);
                                    }
                                }
                                else
                                {
                                    dataList.TryGetEntry(strIndx, out indexBinaryEntry, out error);
                                    indexItem = indexBinaryEntry.FetchScalar();
                                }
                                if(indexItem != null)
                                {
                                    expression = expression.Replace(string.Format("({0})", strIndx), string.Format("({0})", indexItem.TheValue));
                                }
                            }

                            try
                            {
                                CreateScalarDebugItems(expression, itemx.TheValue, labelText, results, "", groupIndex);
                            }
// ReSharper disable EmptyGeneralCatchClause
                            catch(Exception)
// ReSharper restore EmptyGeneralCatchClause
                            {
                                
                            }
                        }
                    }
                    else
                    {
                        IBinaryDataListItem item = dlEntry.FetchScalar();
                        try
                        {
                            CreateScalarDebugItems(expression, item.TheValue, labelText, results, "", groupIndex);
                        }
                        catch(Exception)
                        {
                            CreateScalarDebugItems(expression, null, labelText, results, "", groupIndex);
                        }
                    }
                }
            }
            else
            {
                // Complex expressions are handled differently ;)
                if(dlEntry != null)
                {
                    ComplexExpressionAuditor auditor = dlEntry.ComplexExpressionAuditor;

                    int idx = 1;

                    foreach(ComplexExpressionAuditItem item in auditor.FetchAuditItems())
                    {
                        int grpIdx = idx;
                        string groupName = item.RawExpression;
                        string displayExpression = item.RawExpression;
                        if(displayExpression.Contains("()."))
                        {
                            displayExpression = displayExpression.Replace("().",
                                string.Concat("(", auditor.GetMaxIndex(), ")."));
                        }
                        if(displayExpression.Contains("(*)."))
                        {
                            displayExpression = displayExpression.Replace("(*).", string.Concat("(", idx, ")."));
                        }

                        results.Add(new DebugItemResult
                        {
                            Type = DebugItemResultType.Variable,
                            Label = labelText,
                            Variable = displayExpression,
                            Operator = string.IsNullOrEmpty(displayExpression) ? "" : "=",
                            GroupName = groupName,
                            Value = item.BoundValue,
                            GroupIndex = grpIdx
                        });

                        idx++;
                    }
                }
            }

            return results;
        }
 public List<IDebugItemResult> CreateDebugItemsFromEntry(string expression, IBinaryDataListEntry dlEntry, Guid dlId, enDev2ArgumentType argumentType, int indexToUse = -1)
 {
     return CreateDebugItemsFromEntry(expression, dlEntry, dlId, argumentType, "", indexToUse);
 }
        // Travis.Frisinger - 29.01.2013 : Bug 8412
        /// <summary>
        /// Shapes the dev2 definitions to data list.
        /// </summary>
        /// <param name="definitions">The definitions as binary objects</param>
        /// <param name="defType">Type of the def Input or Output</param>
        /// <param name="pushToServer"></param>
        /// <param name="errors"></param>
        /// <returns></returns>
        public StringBuilder ShapeDev2DefinitionsToDataList(IList <IDev2Definition> definitions, enDev2ArgumentType defType, bool pushToServer, out ErrorResultTO errors)
        {
            ErrorResultTO allErrors = new ErrorResultTO();
            var           dataList  = DataListUtil.ShapeDefinitionsToDataList(definitions, defType, out errors);

            allErrors.MergeErrors(errors);
            errors.ClearErrors();

            // ReSharper disable RedundantAssignment
            StringBuilder result = new StringBuilder(GlobalConstants.NullDataListID.ToString());

            // ReSharper restore RedundantAssignment

            if (pushToServer)
            {
                //  Push to server and return GUID
                byte[] data = new byte[0];
                result = new StringBuilder(_svrCompiler.ConvertTo(null, DataListFormat.CreateFormat(GlobalConstants._XML), data, dataList, out errors).ToString());
            }
            else
            {
                result = dataList; // else return the datalist as requested
            }

            return(result);
        }
 /// <summary>
 /// Shapes the specified current dlid.
 /// </summary>
 /// <param name="curDlid">The current dlid.</param>
 /// <param name="typeOf">The type of.</param>
 /// <param name="defs">The defs.</param>
 /// <param name="errors">The errors.</param>
 /// <param name="overrideID">The override unique identifier.</param>
 /// <returns></returns>
 public Guid Shape(Guid curDlid, enDev2ArgumentType typeOf, string defs, out ErrorResultTO errors, Guid overrideID = default(Guid))
 {
     return(_svrCompiler.Shape(null, curDlid, typeOf, defs, out errors, overrideID));
 }
 public static string GenerateMapping(IList <IDev2Definition> defs, enDev2ArgumentType typeOf) => DataListFactory.GenerateMapping(defs, typeOf);
 public static string GenerateMapping(IList<IDev2Definition> defs, enDev2ArgumentType typeOf)
 {
     return DataListFactory.GenerateMapping(defs, typeOf);
 }
 public List<IDebugItemResult> CreateDebugItemsFromString(string expression, string value, Guid dlId, int iterationNumber, enDev2ArgumentType argumentType)
 {
     return CreateDebugItemsFromString(expression, value, dlId, iterationNumber, "", argumentType);
 }