Expression on VC with decimal data type returns zero

Added a VC of type Decimal. Trying to write an expression with 6 values. Nothing is working. Reduced the expression to display one of the numbers. It comes out as Zero every time.

Date Types:

  • INTEGER: Wind[Speed]
  • DECIMAL: Drift[Factor]

Also tried:

  • Drift[Factor]*1.0
  • DECIMAL(Drift[Factor])
  • Drift[Factor] (errors stating the return value is of type list)
  • Decimal(Wind[Speed] * Drift[Factor])
  • Decimal(Wind[Speed]) * Drift[Factor]
  • Wind[Speed] * Drift[Factor]

Confused why this is so difficult. This seems like one of the most basic things one might want to do… What am I missing?

https://community.appsheet.com/t/referencing-a-column-value-in-a-table-versus-referencing-all-column-values-in-the-entire-table/50771

https://help.appsheet.com/en/articles/4575739-list-from-table-column-reference

1 Like

How does this relate to performing math expressions on a VC of type Decimal?
Game on if it does, just not seeing the connection.

I’ll take a run at this… I think what Marc is saying is that you are referencing a list in your expressions where you probably mean to reference a value. Assuming you have a table called Wind and a column called Speed then whenever you say Wind[Speed], appsheet returns a list of all the values appearing in that column across all rows. When you reference [Speed] without the table name, you get the value of [Speed] for this row.

1 Like

Again, it appears you didn’t read the docs.

Is there another possibility than making a circular reference for something I’ve admitted isn’t clear? See dozens of folks asking the same type question, with confusing threads.

Is there an existing example I could look at which shows how to utilize numbers from different tables in an expression of type decimal?

If I understand what you’re saying… Whenever an expression uses anything from another table, even if one specific value it will still be of type list? Seems odd… But ok.

Is there an existing example I could look at which shows how to utilize numbers from different tables in an expression of type decimal?

Thanks for the explanation!

Read. The. Doc.

You have a fundamental misunderstanding that is addressed by the docs @Marc_Dillon provided.

1 Like

I think you misunderstand.
tableName[columnName] returns a list.

[columnName] by itself returns the cell value for that column in [_THISROW].
if you want a to return a single value from a row other than this row, try lookup(), which will return the value any specified cell.

1 Like

This appears to work. Is there any advantage/disadvantage to use MAX vs Lookup?

max(Drift[Factor]) * max(Wind[Speed])

As you pointed out, referencing cells from other tables are returns datatype LIST. A list of one item needs to be converted to a number or decimal in order to work with it mathematically. Wrapping the returned LIST with a function to extract the value inside allows this to work.

Thank you!

You’re welcome, but to clarify, it’s not whether or not the table is the current table or a different table that delineates whether or not the return is is a list or a value. It’s whether or not the statement includes the table name. So, even for the current table, tableName[columnName] would return a list.

2 Likes