Formula does not work

I have make a new GS, with everything as Plain text, and all type in appsheet is text, but when I run this code IF(ISBLANK([_THISROW].[Ontvang]), 0, [_THISROW].[Beskikbaar] + [_THISROW].[Ontvang]), i am getting this error Column ‘Beskikbaar’ in Table ‘Eenhede 2_Schema’ of Column Type ‘Text’ has an invalid expression in the Formula field.‘=IF(ISBLANK([_THISROW].[Ontvang]), 0, [_THISROW].[Beskikbaar] + [_THISROW].[Ontvang])’. Arithmetic expression ‘([_THISROW].[Beskikbaar]+[_THISROW].[ontvang])’ has inputs of an invalid type ‘Unknown’ does not mter to waht type i use alwasy the same error.

1 Like

Remove all instances of “[_THISROW].”

And if you’re adding values together, they have to be numeric, not text.

Ok ,I understand that one, but when I add it, then I cannot type in the columns beskikbaar as it is greyed out.

The next one must have [_THISROW]) in or am y wrong, it is giving error

Column ‘Gebruik’ in Table ‘Eenhede 2_Schema’ of Column Type ‘Decimal’ has an invalid expression in the Formula field.‘=IF(OR(ISBLANK([Beskikbaar][_THISROW]),[Bedrag][_THISROW] > 0),“”,[Beskikbaar][MAX(ROW([_THISROW]) - LIST(1, COUNT([Beskikbaar][_THISROW]))) - [Beskikbaar][_THISROW]])’. Column ‘Beskikbaar’ is used in a SELECT or list dereference expression and should be a List/EnumList of Refs

IF(OR(ISBLANK([Beskikbaar][_THISROW]),[Bedrag][_THISROW] > 0),“”,[Beskikbaar][MAX(ROW([_THISROW]) - LIST(1, COUNT([Beskikbaar][_THISROW]))) - [Beskikbaar][_THISROW]])

Ok ,I understand that one, but when I add it, then I cannot type in the columns beskikbaar as it is greyed out.

When you add an App Formula to a real column, it becomes un-editable, because its value is now being calculated.

The next one must have [_THISROW]) in or am y wrong, it is giving error> > Column ‘Gebruik’ in Table ‘Eenhede 2_Schema’ of Column Type ‘Decimal’ has an invalid expression in the Formula field.‘=IF(OR(ISBLANK([Beskikbaar][_THISROW]),[Bedrag][_THISROW] > 0),“”,[Beskikbaar][MAX(ROW([_THISROW]) - LIST(1, COUNT([Beskikbaar][_THISROW]))) - [Beskikbaar][_THISROW]])’. Column ‘Beskikbaar’ is used in a SELECT or list dereference expression and should be a List/EnumList of Refs> > IF(OR(ISBLANK([Beskikbaar][_THISROW]),[Bedrag][_THISROW] > 0),“”,[Beskikbaar][MAX(ROW([_THISROW]) - LIST(1, COUNT([Beskikbaar][_THISROW]))) - [Beskikbaar][_THISROW]])

This expression is wrong in many ways. So much so that I really have no idea what you’re trying to do. Did you mean to use a list dereference?

https://help.appsheet.com/en/articles/4575708-list-dereference

You definitely cant list-dereference “into” [_THISROW], that just makes no logical sense.

So, maybe explain what you’re actually trying to do, and show a screenshot of your column config.

Thank you. I will try to explain. I am very bad at explaining. I hope this makes sense to you.

Bedrag
In ‘Beskikbaar’, I want to use the following formula: If I add data in 'Ontvang," then in “Beskikbaar” (current row), it should show the following, which is obtained by adding together 'Ontvang (current row) and ‘Beskikbaar’ (previous row).

Gebruik
If I add in 'Available_input," then in 'use," it should subtract the previous 'available and current available from each other and show in Available."

Koste
this one is working

Ok, so this is an inventory/transaction table, where [beskbaar] is the current inventory quantity, [gebruik] is the amount used up or subtracted from the quantity, and [ontvang] is the amount added to the quantity, right?

First, if there is ever the possibility that more than 1 user/device will be adding records to this table around the same time, your system is going to fail, because the previous record to which it would be adding/subtracting quantity to will sometimes not be the actual previous record. I would not suggest continuing with this setup unless you’re positive that only 1 user/device will be inputting data at a time. I’d suggest searching this forum for “inventory” to find a better way to build it, there should be lots of info as it is one of the most prominent applications that Appsheet is used for. Also check out sample apps.

But to get the previous record, you’d have to use something like:

MAXROW( table , datum , [datum] < [_THISROW].[datum] )

Wrap that maxrow within a LOOKUP() to get any other value from that record besides its key value, like the previous record’s [beskibaar] as such:

LOOKUP( MAXROW(…) , table , key-column , beskibaar )

So in total, your formula for [beskibaar] could be something like:

LOOKUP( MAXROW(…) , … ) + [ontvang] - [gebruik]

https://help.appsheet.com/en/articles/2357310-maxrow

https://community.appsheet.com/t/faq-filter-lookup-maxrow-minrow-ref-rows-and-select/24216

https://help.appsheet.com/en/articles/2357309-lookup

https://help.appsheet.com/en/collections/377977-expressions

IF(
  OR(
    ISBLANK([Beskikbaar][_THISROW]),
    [Bedrag][_THISROW] > 0
  ),
  "",
  [Beskikbaar][MAX(ROW([_THISROW]))] - [Beskikbaar][MIN(ROW([_THISROW]))]
)