[_ROWNUMBER] not showing in INITIAL VALUE when entry is added via Automation Bot

Hi Team,

I need help with using [_ROWNUMBER] in an Initial Value expression.
It works fine when adding new rows through a Form via "Add" action button.

My Problem is when I create records from another table.
To explain, this is my setup.

MY TABLES

From Table (Read only table from Google Form submissions)
Timestamp : DateTime : Initial Value = NOW()
Submitter : Email : Initial Value = USEREMAIL()

To Table
ID : Text : Initial Value = UNIQUEID() & [_ROWNUMBER]
Timestamp : DateTime 
Submitter : Email 

 

MY CUSTOM ACTION

I created a custom action called "Copy Now action" to copy news rows in the From Table into the To Table, as follows:

For a record of this table:  From Table
Do this: Data : Add a new row to another table using values from this row
Table to add to: To Table
Set these columns :
Timestamp = [Timestamp]
Submitter = [Submitter]
Only if this condition is true:  NOT( IN([Timestamp], To Table[Timestamp]) )

The custom action works properly and To Table's [ID] initial value is assigned properly using the [_RowNumber] of the new records. 
It also works properly when the action is executed on multiple rows at once.

THE PROBLEM (AUTOMATION BOT)

I then created an Automation Bot to run the custom action every hour.

Event: 
Schedule: Hourly
For Each Row in Table: TRUE
Table: From Table
Filter Condition: NOT( IN([Timestamp], To Table[Timestamp]) )

Process: 
Run a Data Action:  "Copy Now action"

When I run the process, it is able to make the necessary copies of the From Table into the To Table.
However, the generated ID (which has the initial value = UNIQUEID() & [_ROWNUMBER]) only includes the UNIQUEID() part.  The [_ROWNUMBER] part is not being generated in the Initial value.

How do I go about fixing this?

0 1 78
1 REPLY 1

As per my understanding since bot execution is on server side, it does not recognize the [_ROWNUMBER] for the new rows being added.

You may want to try an initial value expression of 

UNIQUEID()& (MAX(To Table[_RowNumber])+
                                                                                                COUNT(
SPLIT(
ANY(
SPLIT(
(" , " & SELECT(From Table[From Table Key],  NOT( IN([Timestamp], To Table[Timestamp]) ) )& " , "),
(" , " & [From Table Key] & " , ")
)
),
" , "
)
))

 

Sorry, the indenting of the above expression is bad but essentially it is

UNIQUID() & ( MAX Row Number of "To Table" before Bot fires+ ( Index number for each newly added row computed from number of rows to be added))

The above approach basically adds a dynamically computed index based on the number of records that need to be added to the "To Table" from the "From Table". The Index is calculated based on number of records to be added found by expression

SELECT(From Table[From Table Key],  NOT( IN([Timestamp], To Table[Timestamp]) ) ) and the position or index of each new record's key found by [From Table Key].

This indexing expression is based on the INDEXOF() expression tip by @Steve 

INDEXOF() - Google Cloud Community

This index for each record is then added to the MAX(To Table[_RowNumber]) , which is the maximum row number of the 'To Table"  before the bot execution begins. 

However as with any [_ROWNUmber] based sequential number executions, this approach will fail in multi user environments, meaning of multiple users execute this bot simultaneously. 

I tested it and it works. You can see that the [OrderDetail ID] column's last two digits are appended as per row number

Suvrutt_Gurjar_1-1704962953278.png

Note: Just in case the [_ROWNUMBER] to be tracked is of "From Table" the part of expression MAX(To Table[_RowNumber]) could be replaced with  MAX(From Table[_RowNumber])

 

 

                                          

Top Labels in this Space