private void Button_Click(object sender, RoutedEventArgs e)
        {
            SQLParser parser = new SQLParser();
            var       query  = parser.Tokenize(QueryBox.Text);
            int       pivotIndex;
            string    compareTo;

            if (query.Error == "")
            {
                // Se localiza la entidad
                if (App.CurrentProject.Entities.Any(x => x.Name == query.Table))
                {
                    var entity = App.CurrentProject.Entities.Find(x => x.Name == query.Table);


                    // Se localizan los indices de los campos
                    List <int> fieldIndexes = new List <int>();

                    foreach (string campo in query.fields)
                    {
                        int index = entity.Attributes.FindIndex(attr => attr.Name == campo);
                        if (index != -1)
                        {
                            fieldIndexes.Add(index);
                        }
                        else
                        {
                            return;
                        }
                    }

                    // Condicion
                    if (query.Comparer != "")
                    {
                        // Se checa el campo de la condicion a cmparar
                        int index = entity.Attributes.FindIndex(attr => attr.Name == query.OpA);
                        if (index != -1)
                        {
                            pivotIndex = index;
                            compareTo  = query.OpB;
                        }
                        else
                        {
                            index = entity.Attributes.FindIndex(attr => attr.Name == query.OpA);
                            if (index != -1)
                            {
                                pivotIndex = index;
                                compareTo  = query.OpA;
                            }
                            else
                            {
                                return;
                            }
                        }


                        // Aqui ya se vacian todos los registros

                        DataTable tabla = new DataTable();

                        foreach (DataRegister register in entity.Registers)
                        {
                            if (register == entity.Registers[0])
                            {
                                foreach (int fieldIndex in fieldIndexes)
                                {
                                    DataColumn col = new DataColumn();
                                    col.ColumnName = entity.Attributes[fieldIndex].Name;
                                    tabla.Columns.Add(col);
                                    col.ReadOnly = true;
                                }
                            }



                            if (EvalCondition(register, pivotIndex, compareTo, query.Comparer))
                            {
                                DataRow r = tabla.NewRow();

                                foreach (int fieldIndex in fieldIndexes)
                                {
                                    r[entity.Attributes[fieldIndex].Name] = register.Fields[fieldIndex].value;
                                }
                                tabla.Rows.Add(r);
                            }
                        }
                        QueryResults.ItemsSource = tabla.DefaultView;
                    }
                }
            }
        }