How to add text (including calculated values to) Views

I am new to Appsheet and am having trouble working out how to do the following. I have tried to play around with expressions but am not getting very far. I have searched in the docs and also don’t really find anything that obviously addresses this. Maybe there’s a tutorial ?

I have a simple app with based on 1 spreadsheet (of a list of mountains, which can be ticked off when climbed) with 1 deck view, 2 report views and the standard Forms for each. On potentially any / all of these I want to place some text at the top of the page saying, for example, “You have climbed x% of the mountains”, where x is the % all rows where a column called Done = TRUE.

So I have 2 issues;

  1. How to place pure text somewhere on my form (incl. how to specifiy where it goes)
  2. How to create the value for x

Any help much appreciated. Sorry if this is explained somewhere already.

0 8 3,682
  • UX
8 REPLIES 8

Hi there,

Here’s a quick app that has some of these examples in it, including:

  1. reference between climber and mountain
  2. count for each climber number of mountains climbed, and
  3. create a banner of text and percentage. This is a virtual field.

Hope this helps!

https://www.appsheet.com/samples/Built-from-your-app-spec-?appGuidString=b4226b16-d95d-40dc-ac6c-7a2...

Steve
Platinum 4
Platinum 4

For this, you’ll probably want to use a column of type Show, which are described in here:

Show columns are positioned in a form like any other column. If it’s a normal (non-virtual) column, place it in your spreadsheet where you want it to occur in the form–probably as the first column of the row. If you choose to use a virtual column, you’ll need to use the more-advanced approach of using a slice to reorder the columns. Given that you’re new to AppSheet, I recommend using a column in your spreadsheet.

One of the configuration options for the Show column is Content, which allows you to enter an expression that will produce the text to be displayed. You’ll need to construct an expression that gives you what you want. It may look something like this:

CONCATENATE(
  "You have climbed ",
  ROUND(
    (COUNT(FILTER("Mountains", [Done])) * 1.0)
    / (COUNT(FILTER("Mountains", TRUE)) * 1.0)
    * 100.0
  ),
  "% of the mountains"
)
  1. FILTER("Mountains", [Done]) gets a list of all rows in the Mountain table where the Done column value is TRUE.

  2. FILTER("Mountains", TRUE) gets a list of all rows in the Mountains table.

  3. (COUNT(FILTER(...)) * 1.0) counts the number of rows given by FILTER(), producing an integer. Multiplying by 1.0 converts the integer to a real number.

  4. (... / ... * 100.0) computes the percentage as a real number.

  5. ROUND(...) rounds the percentage to the nearest integer.

  6. CONCATENATE(...) constructs the text of the message, including the computed percentage.

See also:

Show columns are da

Thanks steve - thats great and almost there. However My Text1 field as below still does not appear anywhere on any of my views and I can’t figure out why…

In UX >> Options, make sure Include Show columns in detail views is ON.

2X_3_3121090c3df40632d2950d32d7210142b4143019.png

Thanks, that was off but is now on, but the Text column only appeared after I fiddled around with Column order or Header columns but it’s now as I wanted it.

Really appreciate this help to get up to speed. So if I may, a couple of other points …

  1. Ideally I’d like to able to specify it as a page header on every view, or at least on my default initial view, which is either a Deck or Report - is that possible? Is there a concept of global page (view) headers and footers ?
  2. Also - Am I right in thinking that there is no way to specifiy the exact position (or html cell) for any given column ?
  3. Is there a way to just add text to a view other than via a column to hold the text as I have done ?

Nope.

Correct: there is no fine-grain layout control.

Nope, though a Show column can be virtual, so you could at least avoid the spreadsheet column.

Got it. Many thanks.

Top Labels in this Space