0

Is there another way to display the filtered data?

I want to display the data according to the SHOW in HOME, but I can't sort it by the number of repetitions in descending order. Is there a way to use Functions to display it?

22 replies

null
    • Fred
    • 5 mths ago
    • Reported - view

    What you are showing is the grouping function of the column. There is no way to tell Ninox to order the group number in the table view.

    I would recommend that you use a dashboard and view elements or build HTML tables that can organize the data that you want.

      • gold_cat
      • 5 mths ago
      • Reported - view

       I want to know how to do it. Fred. HTML is also a new course.

    • Fred
    • 5 mths ago
    • Reported - view
     said:
    I want to know how to do it.

    If you want to use a view element then you have two choices to make:

    1) a create a new table of unique data from copy.name then you can add a formula field in this new table that will count the number of records in copy that match then you can link your view element to this new table and there you go.

    2) if you don't want to create a new table then you:

    a) have to create an array of the unique values from name

    b) then do a for loop that finds the first or last record of each value in the new array

    c) then you can create new formula field in the view element that then counts the number of records that match the name value.

    You can pick one that you think works best for you. Or if you want to expand your skills you can do both.

    You have a tried doing html already, so this new way is to create a JSON table that you will use to build your html table.

    Try this in a new formula field in the Home table:

    let aa := this;
    let getCopy := (select copy where 'Y&N' = aa.'Y&N');
    let uniqueNameArray := unique(getCopy.name);
    let newData := for loop1 in uniqueNameArray do
            {
                category: loop1,
                count: count(getCopy[name = loop1])
            }
        end;
    newData order by -number(count)
    

    You will see a new "table" showing you data in an arrangement that is close to what you want. Now you can use this JSON to build your html tables.

      • gold_cat
      • 5 mths ago
      • Reported - view

       Thank you, Fred. I feel like I'm close to succeeding, but how can I use this JSON to build my HTML tables? I've tried many times but it's not correct.

      let aa := this;
      let getCopy := (select copy where 'Y&N' = aa.'Y&N');
      let uniqueNameArray := unique(getCopy.name);
      let newData := for loop1 in uniqueNameArray do
              {
                  category: loop1,
                  count: count(getCopy[name = loop1])
              }
          end;
      newData order by -number(count);
      "-------------------------------------------------------------------------";
      let css := "
      <style>
      table{
          width:100%;
          background-color:rgb(255,255,255)
      }
      .tableFixHead {
          overflow-y: auto;
          height: 100%;
      }
      th {
          padding: .2em .5em;
          background-color: rgb(65,105,251); 
          color:white;
      }
      ttt {
          padding: .2em .2em;
          color: rgb(65,105,251);
          font-size: 1em;
          font-weight: bold;
      }
      td{
          font-size:small;
          padding: .1em .5em;
          border-radius:.1em;
      }
      thead,tfoot{
          position: sticky;
          font-size:small;
      }
      thead {
          top: -.3em;
          text-align:center; 
      }
      tr{background-color:rgb(255,255,255);}
      tfoot{bottom: -.3em;}
      tr:nth-child(odd){background-color: rgb(250,250,250);}
      td:nth-child(n+3){text-align:right;}
      tr:hover{background-color:rgb(240,240,240);}
      </style>";
      let thead := ---
          <thead>
              <tr>
                  <th style="white-space: nowrap;"> category </th>
                  <th style="white-space: nowrap;"> count </th>
              </tr>
          </thead>
          ---;
      let tbody := ---
                  <td style="text-align:center; font-weight: bold; font-size: 0.9em; line-height: 1.2;"> { (newData order by -number(count)).[category] } </td>
                  <td style="text-align: left; white-space: nowrap;"> { (newData order by -number(count)).[category] } </td>
          ---;

      html(---
       <aside class='tableFixHead'>{ css }<table>{ thead }{ tbody }</table></aside>
      ---)

    • Fred
    • 4 mths ago
    • Reported - view
     said:
    I feel like I'm close to succeeding, but how can I use this JSON to build my HTML tables?

     You can try this:

    let aa := this;
    let getCopy := (select copy where 'Y&N' = aa.'Y&N');
    let uniqueNameArray := unique(getCopy.name);
    let newData := for loop1 in uniqueNameArray do
            {
                category: loop1,
                count: count(getCopy[name = loop1])
            }
        end;
    "-------------------------------------------------------------------------";
    let css := "
        <style>
        table{
            width:100%;
            background-color:rgb(255,255,255)
        }
        .tableFixHead {
            overflow-y: auto;
            height: 100%;
        }
        th {
            padding: .2em .5em;
            background-color: rgb(65,105,251);
            color:white;
        }
        ttt {
            padding: .2em .2em;
            color: rgb(65,105,251);
            font-size: 1em;
            font-weight: bold;
        }
        td{
            font-size:small;
            padding: .1em .5em;
            border-radius:.1em;
        }
        thead,tfoot{
            position: sticky;
            font-size:small;
        }
        thead {
            top: -.3em;
            text-align:center;
        }
        tr{background-color:rgb(255,255,255);}
        tfoot{bottom: -.3em;}
        tr:nth-child(odd){background-color: rgb(250,250,250);}
        td:nth-child(n+3){text-align:right;}
        tr:hover{background-color:rgb(240,240,240);}
        </style>";
    let thead := ---
            <thead>
                <tr>
                    <th style="white-space: nowrap;"> category </th>
                    <th style="white-space: nowrap;"> count </th>
                </tr>
            </thead>
        ---;
    let tbody := "<tbody>" +
        (newData order by -number(count)).("
                    <tr>
                        <td style=""text-align:center; font-weight: bold; font-size: 0.9em; line-height: 1.2;""> " +
        category +
        " </td>
                        <td style=""text-align: left; white-space: nowrap;""> " +
        count +
        " </td>
                    </tr>
                    </tbody>");
    html(" " + css + "<table> " + thead + tbody + " </table>")
    

    Review the changes to lines 59 - 70. It can be confusing to keep track of breaking in/out of Ninox code.

      • gold_cat
      • 4 mths ago
      • Reported - view

      It may not be correct to show this

      • Fred
      • 4 mths ago
      • Reported - view

       Is the picture what you see?

      I get:

      • gold_cat
      • 4 mths ago
      • Reported - view

       Can you share the database, Fred? I've tried everything and it's still the same...

      • gold_cat
      • 4 mths ago
      • Reported - view

       All I see is "category count" (as shown in the image above). What's the problem?

      • Fred
      • 4 mths ago
      • Reported - view

      Here is my DB.

      • gold_cat
      • 4 mths ago
      • Reported - view

       

      It's strange, Fred. When I open your database, it's the same as what @MZ sent, there's no Functions window.

      • Fred
      • 4 mths ago
      • Reported - view

      are you looking in the Home table?

      • gold_cat
      • 4 mths ago
      • Reported - view

       Yes.

      • Fred
      • 4 mths ago
      • Reported - view

       wait, the html works just fine. What is the problem?

      • red_kite
      • 4 mths ago
      • Reported - view

      Hi, Fred. Is possible, that is not the right one db (fred-v1.ninox) above? Download this again here and try it. ;-)

    • red_kite
    • 4 mths ago
    • Reported - view

    For the normal table view, you can use a sorting column with my rather confusing, ugly code for grouping.

      • gold_cat
      • 4 mths ago
      • Reported - view

       

      . How did you do it, my friend?

      • red_kite
      • 4 mths ago
      • Reported - view

       Look.

      • gold_cat
      • 4 mths ago
      • Reported - view

       Thank you for your help.

    • red_kite
    • 4 mths ago
    • Reported - view

    Mistake

    • gold_cat
    • 4 mths ago
    • Reported - view
     said:
    Here is my DB.

     

    The problem is that this doesn't seem to be a database with "Functions".

    • Ninox Widgets & User Interfaces
    • Jakob_Jordan
    • 3 mths ago
    • Reported - view

    Hey :) 

    Take a look here: https://www.arc-rider.de/documentation/customsort-einbinden

    We have developed widgets for ninox. Among other things, a sorting widget that you can integrate into a custom table. This way you can easily sort the view. 

    If you have any questions about this, please feel free to get in touch :)

Content aside

  • Status Answered
  • 3 mths agoLast active
  • 22Replies
  • 128Views
  • 4 Following