Retrieve the value of a field from the same record in a new row process (BOT)

Hi everyone, I created a bot that every time I add a record in table A it adds 5 records in table B like this:
The activator of the bot is precisely the event configured as follows:
Data change -> Adds only -> Table A

In the process below I selected the item "Run a data action" and then "Adds new rows" in table B with the following values:

ID (type text) = UNIQUEID()
DATE (date type) = TODAY()
CMT (percentage type) = "100%"
KG (type number) = [a column of table A]
RIP (type number) = 1
TON (type number) = b[KG] * b[RIP] ---> here I get the error: "Arithmetic expression '(b[KG] * b[RIP])' has inputs of an invalid type 'Unknown' .
N.B. "b" is the table that I called that for simplicity.

I can't understand why and yet they are the same type, I tried to cast using NUMBER() function but I always get 0 ( NUMBER(b[KG]) * NUMBER(b[RIP]) ) if I try to insert as expression only b[KG] the error becomes this "The expression is valid but its result type 'List' is not one of the expected types: Number"

I would like TON to be equal to the product of the value entered in KG by the value entered in RIP in the same entry so that it is calculated row by row dynamically.

What am I doing wrong? Is there someone who can help me?

Thank you

0 4 79
4 REPLIES 4

table[column] returns a list of values and not a single number value. therefore you cannot multiply two lists by the operator *. (well no easy way in AppSheet to multiply two lists..)

ANY(table[column]) returns a single value but you never know which one...  You should write expressions to specify what you need.

Thanks for the reply, I need to create a formula to insert in the column of a table (A for simplicity) that allows you to multiply two values that are part of the same row of a different table (B for simplicity) having a specific ID and a value specific in a column (CMT).

ID = 1234
CMT = 95%

Is it clearer now?

I assume you are looking for something like..
LOOKUP([_THISROW].[ID],TableB,ID,KG) *
LOOKUP([_THISROW].[CMT],TableB,CMT,RIP)

This finds the row from tableB where ID and CMT matches. but please remember that it picks the first row where it matches. If you have only one row with the same ID or CMT, you are fine.

Seems like you need

INDEX(SELECT(b[KG], AND([ID]=[_THISROW].[ID], [CMT]=[_THISROW].[CMT]),1)
*
INDEX(SELECT(b[RIP], AND([ID]=[_THISROW].[ID], [CMT]=[_THISROW].[CMT]),1)

 

Top Labels in this Space