AppSheet Office Hours: How to Use and Optimize App Expressions

Published on ‎04-25-2022 07:28 AM by Community Manager | Updated on ‎04-25-2022 07:30 AM

For app creators, expressions are a powerful way to customize behavior and add sophisticated logic throughout your app, from incorporating conditional statements and managing lists, to extracting data from images, detecting user details, and much more. 

However, it can be challenging to know which expressions to use where, and the best way to build them into your app to deliver the results you want.

Join us for AppSheet Office Hours on May 19th, where our experts will deep dive into all things AppSheet expressions, including:

  • Types of expressions and when to use them

  • How to build and test expressions 

  • Common use cases and live demos

As always, you’ll have the opportunity to ask any questions (even if they’re not directly related to the session topic) and receive answers live from AppSheet experts.  Pro tip: the best way to get your questions answered is by adding them in advance to the comments section below!

With our new series of AppSheet Office Hours, it’s our goal to provide a trusted space where you can receive support and guidance along your app creation journey. We hope to see you there!

Meeting information:



Featured Guests


Staff


Event has ended
You can no longer attend this event.

Start:
Thu, May 19, 2022 11:00 AM PDT
End:
Thu, May 19, 2022 12:00 PM PDT
42 Comments
MedAmineIT
Bronze 2
Bronze 2

Hi 
in each order record i want to make a enum list of ref values from an other table (Products), i want to select multiple items from the droped list those items from products table which contain the following coloms : product id, product name , product price
now after selecting those products from the droped list i want to sum price of them 
how  can i do that ?
thank you for your answer 

 

Kirk_Masden
Gold 1
Gold 1

Hi!  I'm quite late but just catching up on this now.  I'm partway through the video and am interested in Derek's demonstration.  Was this app made available to us as a template that we can copy and play with on our own?  If not, I'd like to request that in similar situations in the future, all demonstration apps be made available as templates.

Hi @Kirk_Masdenhere's the link to the app and here's a link to the app definition for you to make a copy.

Hope this helps! We'll have an event recap post coming soon, which will summarize the session and include these links as well. 

@derekco 

Thanks!

how to distribute data category wise data list 

with images  data, category in combine data display problem so please help in problem

 

mattheweaver05
Bronze 1
Bronze 1
Google Meet logo

Matthew Weaver is inviting you to join a video
call happening now







Join Call



meet.google.com/jzq-svmf-kbs
NCD
Silver 2
Silver 2

Any road map on the AppSheet first party database?

lamontfr
Silver 1
Silver 1

QUESTION : Feasibility of a WITH() function to clarify complex expressions

Would it be possible for AppSheet to add a WITH() function, similar in concept to the WITH clause available in SQL queries ?

Syntax

WITH(constant-name1, constant-value1, [constant-name2, constant-value2...], result)

How it works

  • The WITH function allows to decompose a complex expression into sub-expressions
  • A constant-value can be any expression which is evaluated and assigned to the constant-name
  • The result (and a constant-value) can refer to a previous assigned constant-name by prefixing it with _CONST
  • The WITH function returns the evaluation of the result expression

Benefits

  • Self documenting expressions without requiring inline comments
  • Avoid repeating identical sub-expressions and improve performance
  • Clarify a complex expression by breaking it down without using virtual columns

Example

A table security filter expression returns TRUE for the rows of table employee that should be loaded in a HR App, where the user works on a subset of employees at a time. The filter condition is :

  • The employee in this row is the current App user (has the same Email) OR
  • The employee in this row belongs to the department that the current user wants to update OR
  • The employee in this row previously belonged to the department that the current user wants to update

Example Original Expression

OR(
  [employee_Email] = USEREMAIL(),
  [employee_department_Code] =
    ANY(SELECT(parameter[parameter_DeptUpdate], [parameter_User] = USEREMAIL())),
  IN(
    [employee_id],
    SELECT(
      history[history_employee_Id],
      [history_DeptCode]
        =
        
ANY(SELECT(parameter[parameter_DeptUpdate], [parameter_User] = USEREMAIL())))))

Example Expression rewritten using WITH

WITH(
  "user_department_to_update",
    ANY(SELECT(parameter[parameter_DeptUpdate], [parameter_User] = USEREMAIL())),
  "employee_ids_previously_same_department",
    SELECT(
      history[history_employee_Id],
      [history_DeptCode] = [_CONST.user_department_to_update]),
  OR(
    [employee_Email] = USEREMAIL(),
    [employee_department_Code] = [_CONST.user_department_to_update],
    IN([employee_Id], [_CONST.employee_ids_previously_same_department])))

Have you successfully implemented your original expression in a table security filter? My experience is that it's not possible for a Table Security Filter expression reference to other rows in table, as yours does in the case of the following row--i.e., select all table rows whose [employee_department_Code] column equals the [employee_DeptUpdate] column in the current user's row from the same table.

  [employee_department_Code] =
    ANY(SELECT(employee[employee_DeptUpdate], [employee_Email] = USEREMAIL())),

 

You are completely correct ! Thanks for pointing this out. I implemented a similar table security filter in an App, but I modified the table names in my post and introduced the self reference by mistake.

I edited the post.

 

😥Oh well. I thought you had figured out a technique I could use. Regardless, thanks for clarifying--and for your nice WITH suggestion.

BjRichards97
Bronze 2
Bronze 2

I'm having some trouble with chart creation; I have a sheet listing all of our users as well as some general information about each of them. Three of the columns on this sheet are Yes or No columns on whether or not they have a certain product. I need to show a bar chart where there are three bars, in which each bar represents the total count of "Yes" values of one of the three columns individually. It's simple enough to count all of the "Yes" values in each column using virtual columns and Select and Count expressions, but trying to format the chart to show three bars, the total count of "Yes" in each column seems somewhat unclear. 

Glaede
Bronze 1
Bronze 1

I am trying to build a logistics app that will be driver Facing, and would like to utilize the GeoFencing feature as well as only limit data to a specific driver when they are added to the app. 
I wanted to know if there was a way to limit information to a user up until they are assigned a task/order and when they complete that task/order for it to disappear off their list?

Sorry if this has been answered i am very very new to this program.

 

Jideofor
Bronze 1
Bronze 1

How do you support  an organization to build there app.? If  I build an app in my  google space , how do I send it or share it with the organization?

Dan_Jackman
Bronze 2
Bronze 2

Is AppSheet included in Google Workspace?

Basic applications can be created and shared with small teams in any Workspace account. In order to scale and share apps with larger teams, licenses and an AppSheet subscription is required - AppSheet Core licenses are automatically included in some versions of Workspace Enterprise. Contact Workspace sales for more information.

Thomas_Varghese
Silver 1
Silver 1

you could also go for public apps ..if data is not sensitive and no sign in needed,, any number of users , 50 USD  per app.

Techuke
Bronze 5
Bronze 5

15May22 0827 Greetings from New Zealand. What's the best to minimise deployment licensing costs? (I am thinking of building an app for 20 users.)

All depends on your needs.

I'd say that if you can afford the USD200/month, do it.

If you don't, look for another platform