Two Steps at a bot.

Hi,

I have three tables: Journal, Ledger, and TriaBalance.

I want to execute the following two tasks with one webhook bot.

  1. Add (or overwrite) a row to the Ledger table by aggregating the amount in the Journal table
  2. Add (or overwrite) a row to the TrialBalance table by aggregating the amount in the Ledger table

I was able to get the desired results by creating two tasks as separate bots and executing them separately. However, when I create two Steps in one bot and execute them, the amount is aggregated properly in the Ledger table, but the amount before the change in the Ledger table is aggregated in the TrialBalance.

How can I aggregate the Ledger amount after the change in Step 1 in TrialBalance?

Thank you.

Solved Solved
0 15 258
1 ACCEPTED SOLUTION

Have you evaluated 'Wait Steps" listed in the help article below? 

Steps: The Essentials - AppSheet Help

 

View solution in original post

15 REPLIES 15

Have you evaluated 'Wait Steps" listed in the help article below? 

Steps: The Essentials - AppSheet Help

 

Thank you for your reply.

leinharte_0-1744618263834.png

As above, when I set Period to "005:00:00", after about 5 minutes, the second step was executed by reflecting the value after the change in the first step.

BTW, in my case, the first step add (or overwrites) multiple rows in the Ledger table. Is there a way to do it with "A condition" instead of "A period of time"? Because the next step after this bot is completed is to create a Balance Sheet, and 5 minutes is somewhat inconvenient.

 

Is the reason why the bot does not reflect the results of the previous Step because of the "Step completion time"?

In my experience, for the Step of the "Run a data action" type, the results of the previous Step are reflected.

Please explore putting a condition based wait step rather than a time based wait step.

For example when a change in the particular column that you are aggregating in the Ledger table is completed.

Your could use something like  [_THISROW_BEFORE].{Aggregation Column]<> [_THISROW_AFTER].{Aggregation Column]  as a wait condition for example.

Of course, exact expression will depend on the way your relevant columns are configured.

The bot is not on the Ledger table.

Can I use the expression [_THISROW_BEFORE].[Aggregation Column]<> [_THISROW_AFTER].[Aggregation Column] in this case too?

Yes , depending on how the tables are related through references with each other. If the bot is not in that table, you could perhaps use dereferencing to reference the column in the  other table.

Assuming Journal table is child of Ledger table and the bot is configured in the Journal table, the condition could be something like 

[_THISROW_BEFORE].[Reference column in the Journal Table that references Ledger Table]. [Aggregation Column in the Ledger Table] <> [_THISROW_AFTER].[Reference column in the Journal Table that references Ledger Table]. [Aggregation Column in the Ledger Table]

 

I have a separate table that is independent and designed to trigger the bot when a value changes there.

Is a "condition based wait step" not possible in this case?

When the bot is triggered, I believe it should have some relation with the table records involved in the bot.

You could evaluate if and how that is possible. Alternatively you may want to share more precise details of the tables and columns involved in the bot do that the community could peovide better suggestions.

I appreciate your kind replies.

Let me introduce my app.

(As Is) It is an accounting process that we produce journals during a period and (bot 1) at the end of the period we post the journal to the ledger and (bot 2) then we make the Trial balance sheet from the ledger. Currently, I am using two bots to do posting and creating the Trial balance sheet. So the user has to click the button twice.

The bot 1 and the bot 2 are with "Run a task" and "Call a webhook". And two bots are on the "33_currentperiodbottrigger" table.

There is a separate table "33_currentperiodbottrigger" to trigger the two bots.

(To Be) I want to do it with one click of a button.
So I created a new bot that uses the two bots above as Steps, but in the process, the second Step is creating a Trial balance sheet that does not reflect the execution results of the first Step.

Please understand that the description of the app is limited because the app is written in Korean.

 

Thank you for the details. However I am afraid those may not be good enough to suggest further. However could you mention if there is any relationship between the three tables.

Meaning do many Journal records  have one Ledger record and in turn do many Ledger records can have one Trial Balance record? In general there should be some direct or indirect reference relationship between the three tables because you are using those in aggregation.

Also how the table "33_currentperiodbottrigger" triggers the bots, meaning how do you control exactly which records from Journal, Ledger and Trial Balance tables to add /update through bot getting fired on yet another table "33_currentperiodbottrigger"

 

posting bot event is data change type.

and Condition:
AND(
[_THISROW_BEFORE].[currentperiodbottrigger_trigger] <> [_THISROW_AFTER].[currentperiodbottrigger_trigger],
[ID] = "currentperiodbottrigger_posting"
)

As a matter of fact, the ledger reorders the journal, not compresses it.

The trial balance sheets compresses the ledger.

The three tables are children of the 44_account table. (by Enum_Ref)

 

how do you control exactly which records from Journal, Ledger and Trial Balance tables to add /update through bot getting fired on yet another table "33_currentperiodbottrigger"

=> Webhook Body of the posting bot:

{
"Action": "Add",
"Properties": {
"Locale": "ko-KR",
"Timezone": "Korea Standard Time"
},
"Rows": [
<<START: TheSliceOfJournal[ID]>>
{
"ID": "<<ANY(31_period_01_current[ID]) & "_" & [ID]>>",
"52_์ „ํ‘œ": "<<[52_์ „ํ‘œ]>>",
"44_account": "<<[44_account]>>",
"51_์ „ํ‘œ์œ ํ˜•": "<<[52_์ „ํ‘œ].[51_์ „ํ‘œ์œ ํ˜•]>>",

Thank you. However I am sorry that these details are not good enough to suggest. Especially the below mentioned details are crucial.


@Suvrutt_Gurjar wrote:

Meaning do many Journal records  have one Ledger record and in turn do many Ledger records can have one Trial Balance record? In general there should be some direct or indirect reference relationship between the three tables because you are using those in aggregation.


 

 

The three tables are not directly related. They are only indirectly related through the 44_account table.

To help you understand, the ultimate goal is to aggregate the journal amounts written during the period into a trial balance by account. In other words, you can create a trial balance without a ledger.

Here are three examples of tables:

leinharte_0-1744646963287.png