StringBuilder processViews(List <FieldDefinition> groupFields)
        {
            var builder = new StringBuilder();
            //we add the horizontal linear layout
            //we get all fields and use their labels as headers
            //we get the first row defined as textview, label Type and get its choices
            //we'll use these to repeat the fields
            //for each choice in type, rename fields a bit and add all
            //repeat

            //we write the label
            var addColumnHeaders = false;
            var firstField       = groupFields.FirstOrDefault(t => t.ViewType == "Unique Dataset" || t.ViewType == "Simple Table");

            for (var i = 0; i < firstField.FieldOptions.Values.Count; i++)
            {
                var cleanItemName     = firstField.FieldOptions.CleanValues[i];
                var itemName          = firstField.FieldOptions.Values[i];
                var definitionBuilder = new MinimalViewDefinitionBuilder()
                {
                    ItemName         = itemName,
                    FieldNameSuffix  = cleanItemName,
                    metaDataProvider = this.metaDataProvider,
                    ViewPageName     = this.ViewPageName
                };

                if (addColumnHeaders)
                {
                    addColumnHeaders = false;
                    var labels = (from field in groupFields
                                  where field != firstField && field.DisplayLabel.ToLowerInvariant() != "index"
                                  select field.DisplayLabel).ToList();
                    var headerText = definitionBuilder.getTableHeaderText(labels, firstField);
                    builder.Append(headerText);
                }

                foreach (var field in groupFields)
                {
                    if (field.DisplayLabel.ToLowerInvariant() == "index")
                    {
                        continue;
                    }

                    var fieldXml = getViewDefinitions(definitionBuilder, field);
                    builder.Append(fieldXml);
                }
            }

            //var asString = builder.ToString();
            //System.IO.File.WriteAllText("tables.axml", asString);
            //System.IO.File.WriteAllText("meta.txt", this.metaDataProvider.StringResourcesItems.ToString());
            //Environment.Exit(0);

            return(builder);
        }
        string getViewDefinitions(MinimalViewDefinitionBuilder definitionBuilder, FieldDefinition field)
        {
            var fieldXml = string.Empty;

            switch (field.ViewType.ToLowerInvariant())
            {
            case "simple table":
            case "unique dataset":
            {
                //we treat these as labels
                fieldXml = definitionBuilder.getXamlDefinitionForGrandLabel(field);
                break;
            }

            case "int":
            case "integer":
            case "cell":
            case "cellnumber":
            case "number":
            {
                fieldXml = definitionBuilder.getXamlDefinitionForTextField(field, true);
                break;
            }

            case "time":
            {
                //fieldXml = definitionBuilder.getXamlDefinitionForDate(field, "TimePicker");
                break;
            }

            case "today":
            case "date":
            case "datepicker":
            {
                //fieldXml = definitionBuilder.getXamlDefinitionForDate(field, "DatePicker");
                break;
            }

            case "username":
            case "text":
            case "edittext":
            {
                fieldXml = definitionBuilder.getXamlDefinitionForTextField(field, false);
                break;
            }

            case "label":
            case "image":
            case "start group":
            case "block label":
            case "labelbig":
            case "textview":
            {
                fieldXml = definitionBuilder.getXamlDefinitionForLabel(field, true);
                break;
            }

            case "multiselect":
            case "single multiple":
            case "checkbox":
            {
                fieldXml = (
                    definitionBuilder.getXamlLabelDefForEnumeratedFields(field) +
                    string.Join(Environment.NewLine, definitionBuilder.getXamlLabelDefForCheckBox(field)) + @"");
                break;
            }

            case "singleselect":
            case "single select":
            case "radiogroup":
            {
                if (field.GridColumn == 5)
                {
                    fieldXml = (definitionBuilder.getXamlLabelDefForRadioGroup(field, false) +
                                definitionBuilder.getXamlLabelDefForEnumeratedFields(field) +
                                string.Join(Environment.NewLine, definitionBuilder.getXamlLabelDefForRadioButton(field))
                                + "</RadioGroup >");
                }
                else
                {
                    //we look at the length of the enums and
                    //we change orientation if too long
                    var changeOrientation = false;
                    var lengths           = (field.FieldOptions.Values.Select(t => t.Length)).Sum();
                    if (lengths > 50)
                    {
                        changeOrientation = true;
                    }

                    fieldXml = (definitionBuilder.getXamlLabelDefForEnumeratedFields(field) +
                                definitionBuilder.getXamlLabelDefForRadioGroup(field, changeOrientation) +
                                string.Join(Environment.NewLine, definitionBuilder.getXamlLabelDefForRadioButton(field))
                                + "</RadioGroup >");
                }
                break;
            }

            default:
            {
                var fieldype = field.ViewType;
                throw new ArgumentNullException("Please addlogic for " + field.ViewType);
            }
            }
            return(fieldXml);
        }