Stat: expression

Hi all,

how to use start: expression for both rows and columns in appsheet , for example to calculate items sold per month in columns and items in rows, the columns should be added only if items sold exist in that month.

cheers

0 10 131
10 REPLIES 10

Aurelien
Google Developer Expert
Google Developer Expert

You are probably wondering about how to use virtual columns?

Here is the documentation you are looking for:

Use virtual columns - AppSheet Help

 

Hi not really ๐Ÿ˜Ž

What i am asking is about <<start:[whatever_row]>> <<end>>

and <<start:[whatever_column]>> <<end>>

how can you combine both to put in a pdf , so that the column is dynamically created like the row in pdf.

As an example:

SUM <<start:[items]>> <<end>> (row)

months where items were sold:

<<start:[month]>> <<end>> (column)

btw I asked chatGPT and (it) said that itโ€™s possible ๐Ÿ˜‚

cheers

 

 

 

Aurelien
Google Developer Expert
Google Developer Expert

Forget about ChatGPT, too much noise about that at the moment hahaha

Here is the documentation for help:

Use Start expressions in templates - AppSheet Help

Use If expressions in templates - AppSheet Help

About this part:


@ea_9000 wrote:

so that the column is dynamically created


this is not possible.

Hmmm 

Probably your did not understood my question, any way , i donโ€™t need the documentation as I already build many apps to generate pdfโ€˜s with start expression.

cheers

You can only generate rows with start expressions...can't generate columns.

Aurelien
Google Developer Expert
Google Developer Expert

@ea_9000 wrote:

Probably your did not understood my question,


This is your question:


@ea_9000 wrote:

What i am asking is about <<start:[whatever_row]>> <<end>>

and <<start:[whatever_column]>> <<end>>

how can you combine both to put in a pdf , so that the column is dynamically created like the row in pdf.

As an example:

SUM <<start:[items]>> <<end>> (row)

months where items were sold:

<<start:[month]>> <<end>> (column)


This is my answer:


@Aurelien wrote:

About this part:


@ea_9000 wrote:

so that the column is dynamically created


this is not possible.


This is @scott192 's answer:


@scott192 wrote:

You can only generate rows with start expressions...can't generate columns


Two of us did not understand your question in this case.

BTW, thank you @scott192 for confirming my answer and understanding.

About this:


@ea_9000 wrote:

i donโ€™t need the documentation as I already build many apps to generate pdfโ€˜s with start expression.


Good for you, hence you know this is not possible.

 

However:

A workaround would be to create as many tables with as different numbers of columns, as you wish, and wrap these in IF expressions. I'm just afraid that would come tedious. Hence, my answer, which is kind of a shortcut, is: not possible.

 

If you still  think we don't get your question, please feel free to explain further so that we can help you, or tick one answer as a solution to your question.

Cheers


@scott192 wrote:

can't generate columns.


I wouldn't be so hard on this considering that HTML and XML are options for templates.
I can generate PDFs and Worksheets with as much info as I want.

Just saying FWIW

Then I'm about to learn something today!!!! ๐Ÿค 

How would you do that? Can you share a snipet?

This is a basic HTML to show the way it should be implemented:

Show More
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        background-color: white;
        color: black;
      }
      table {
        border-collapse: collapse;
      }
      table tr th,
      table tr td {
        border: solid red 2px;
        padding: 5px;
      }
    </style>
  </head>
  <body>
    <table>
      <thead>
        <tr>
          <th>Header</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Value</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>

Result:

SkrOYC_0-1673020853555.png

If you want to change the amount of columns:

Show More
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        background-color: white;
        color: black;
      }
      table {
        border-collapse: collapse;
      }
      table tr th,
      table tr td {
        border: solid red 2px;
        padding: 5px;
      }
      p.startifend {
        display: none;
      }
    </style>
  </head>
  <body>
    <table>
      <thead>
        <tr>
          <p class="startifend">&lt;&lt;Start:SomeExpressionOrRefListColumn&gt;&gt;</p>
          <th>Header</th>
          <p class="startifend">&lt;&lt;End&gt;&gt;</p>
        </tr>
      </thead>
      <tbody>
        <tr>
          <p class="startifend">&lt;&lt;Start:SomeExpressionOrRefListColumn&gt;&gt;</p> <!-- This should be identical to the first one -->
          <td>Value</td>
          <p class="startifend">&lt;&lt;End&gt;&gt;</p>
        </tr>
      </tbody>
    </table>
  </body>
</html>

If you just want to change the amount of rows:

Show More
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        background-color: white;
        color: black;
      }
      table {
        border-collapse: collapse;
      }
      table tr th,
      table tr td {
        border: solid red 2px;
        padding: 5px;
      }
      p.startifend {
        display: none;
      }
    </style>
  </head>
  <body>
    <table>
      <thead>
        <tr>
          <th>Header</th>
        </tr>
      </thead>
      <tbody>
        <p class="startifend">&lt;&lt;Start:SomeExpressionOrRefListColumn&gt;&gt;</p>
        <tr>
          <td>Value</td>
        </tr>
        <p class="startifend">&lt;&lt;End&gt;&gt;</p>
      </tbody>
    </table>
  </body>
</html>

If you want both:

Show More
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        background-color: white;
        color: black;
      }
      table {
        border-collapse: collapse;
      }
      table tr th,
      table tr td {
        border: solid red 2px;
        padding: 5px;
      }
      p.startifend {
        display: none;
      }
    </style>
  </head>
  <body>
    <table>
      <thead>
        <tr>
          <p class="startifend">&lt;&lt;Start:SomeExpressionOrRefListColumn&gt;&gt;</p>
          <th>Header</th>
          <p class="startifend">&lt;&lt;End&gt;&gt;</p>
        </tr>
      </thead>
      <tbody>
        <p class="startifend">&lt;&lt;Start:SomeExpressionOrRefListColumn&gt;&gt;</p> <!-- This is for the rows -->
        <tr>
          <p class="startifend">&lt;&lt;Start:SomeExpressionOrRefListColumn&gt;&gt;</p> <!-- This should be identical to the first one -->
          <td>Value</td>
          <p class="startifend">&lt;&lt;End&gt;&gt;</p>
        </tr>
        <p class="startifend">&lt;&lt;End&gt;&gt;</p>
      </tbody>
    </table>
  </body>
</html>

It's important to understand exactly what you want to achive. Multiple columns could be very cumbersome. Also you should think about the styling when there will be an undefined number of columns. If the number is whitin a known range, you could also use expressions inside the style tag

Aurelien
Google Developer Expert
Google Developer Expert

Greaaaaat job @SkrOYC  ! Thanks for sharing ๐Ÿ˜


@SkrOYC wrote:

Also you should think about the styling when there will be an undefined number of columns.


Agreed ๐Ÿ‘

Top Labels in this Space